paperclipai/paperclip · error · HttpError

upstream_error

upstream_error

Error message

Connection token exchange failed

What it means

Token-exchange failure in the child/derived token flow: the broker's HTTP response was non-2xx. The error carries the upstream code (mapped to credential_revoked when the parent was revoked), status, and request id; the upstream broker rejecting the exchange is at fault.

Solutions

  1. The connection token exchange failed. Verify the connection's credentials and the remote service availability, then retry the connection flow.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/src/services/tool-access.ts:1934 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/602dd059dcc109ae. Report an issue: GitHub.

Appendix: source

Thrown at server/src/services/tool-access.ts:2142

  } catch {
    return null;
  }
}

function isOAuthEndpointRejection(error: unknown): boolean {
  if (!(error instanceof HttpError)) return false;
  const code = asRecord(error.details).code;
  return typeof code === "string" && code.endsWith("_endpoint_rejected");
}

function healthFailureHttpStatus(failure: { status: ToolConnectionHealthStatus; code: string }): number {
  if (failure.status === "missing_secret") return 422;
  if (failure.code === "composio_api_key_rejected") return 422;
  if (failure.code.endsWith("_endpoint_rejected")) return 422;
  return 502;
}

function sanitizeHttpFailure(error: unknown): { status: ToolConnectionHealthStatus; message: string; code: string } {
  if (error instanceof ComposioApiError) {
    return {
      status: "error",
      message: error.message,
      code: error.status === 401 || error.status === 403 ? "composio_api_key_rejected" : "composio_request_failed",
    };
  }
  if (error instanceof HttpError) {
    const code = asRecord(error.details).code;
    if (code === "composio_connected_account_inactive") {
      return { status: "degraded", message: error.message, code };
    }
    if (typeof code === "string" && code.startsWith("remote_http_")) {
      return { status: "error", message: error.message, code };
    }
    if (isOAuthEndpointRejection(error)) {
      return { status: "error", message: error.message, code: String(code) };
    }

View on GitHub (pinned to 01ad858492)