Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#14491·paperclip

Connection-intent OAuth failures discard details.code, leaving actionable errors invisible

Author: jaderfeijoCreated Sep 28, 2026Updated Sep 28, 2026

Summary

routes/tool-access.ts computes a precise, actionable failure code for a connection attempt and then discards it. The connection-intent card shows a generic "failed" state, nothing is written to last_error, and nothing is logged — so the operator has no way to learn why, and neither does anyone reading the logs afterwards.

The OAuth callback error path keeps only one distinction:

typescript
} catch (callbackError) {
  if (!acceptsHtml) throw callbackError;
  const details = callbackError instanceof HttpError && ... ? callbackError.details : null;
  if (pendingConnectionIntent && pendingState.interactionId && req.actor.userId) {
    const outcome = details?.code === "oauth_authorization_denied" ? "declined" : "failed";
    await finishConnectionIntentOAuth({ ..., outcome });
    sendConnectionIntentOAuthOutcome(res, { ..., outcome });
    return;
  }

Everything that is not oauth_authorization_denied collapses to failed. details.code goes no further. There is no log.error, and the HTTP layer records a 200 because the failure renders as an HTML page.

Why it matters

Two real cases from a single debugging session, both of which cost hours:

1. github_installation_required. The user had authorized the GitHub OAuth app but never installed the GitHub App, so /user/installations came back empty and loadGitHubGrantMetadata threw with a specific code, an installationUrl and a managementUrl. The card showed only phase: "needs_retry", inviting a retry that could never succeed. The logs showed a clean 200. Diagnosing it meant reading the compiled service source and querying the database directly.

2. slack_mcp_access_disabled. The message — "Slack MCP access is disabled for this app. Ask the Slack app owner to enable MCP access" — names the exact setting to change. It never reached the UI. (One reason is a content-type check, fixed in #14490, but the surfacing path is the more general problem.)

In both cases the codebase had already worked out the answer and threw it away.

Suggestions

Some options, roughly in order of cost:

  • Log the failure with its code when the connection-intent path swallows the error. Cheapest, and would have shortened both cases above.
  • Persist details.code on the intent's result, so the card can render a specific reason.
  • Map the known actionable codes to operator-facing text the way the health path already does in sanitizeHttpFailure. That function is a good model — it distinguishes roughly a dozen codes and their HTTP statuses.
  • Where details carry a setupUrl / installationUrl / managementUrl, surface it as a link on the card. Several throw sites already populate these and nothing consumes them.

Happy to open a PR if you have a preferred direction — I left it out of #14490 because it changes user-visible error behaviour across every connector, which seemed like a call for maintainers rather than a drive-by change.

Context

Found while debugging a self-hosted instance (2026.916.1). Related: #14489 (grant CAS timestamp precision), #14490 (Slack MCP OAuth endpoints).

Source: paperclipai/paperclip

View original on GitHubView discussion on GitHub