paperclipai/paperclip · error · HttpError

oauth_reauthorization_required

oauth_reauthorization_required

Error message

OAuth authorization has expired. Reconnect this app to continue.

What it means

Refresh-grant failure mapping: a refresh_token grant returned invalid_grant, meaning the provider revoked or expired the authorization itself. Mapped to 422 oauth_reauthorization_required prompting the user to reconnect; the expired upstream authorization is at fault.

Source

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

        appProfileOutcome = "deleted";
      } else {
        // `tool_mcp_gateways.profile_id` is ON DELETE RESTRICT, so a gateway
        // pointing here keeps the row alive. Archive it instead — the policy
        // engine only consults `active` profiles, and it has no entries left —
        // and revoke the tokens those gateways already handed out, which are the
        // one credential a caller could still present.
        await db
          .update(toolProfiles)
          .set({ status: "archived", defaultAction: "deny", updatedAt: now })
          .where(eq(toolProfiles.id, appProfile.id));
        appProfileOutcome = "archived";
        const revokedTokens = await db
          .update(toolMcpGatewayTokens)
          .set({ revokedAt: now, updatedAt: now })
          .where(and(
            eq(toolMcpGatewayTokens.companyId, connection.companyId),
            inArray(toolMcpGatewayTokens.gatewayId, gatewayRows.map((row) => row.id)),
            isNull(toolMcpGatewayTokens.revokedAt),
          ))
          .returning({ id: toolMcpGatewayTokens.id });
        gatewayTokensRevoked = revokedTokens.length;
        if (revokedTokens.length > 0) {
          gatewaySessionsRevoked = (await db
            .update(toolGatewaySessions)
            .set({ revokedAt: now, updatedAt: now })
            .where(and(
              eq(toolGatewaySessions.companyId, connection.companyId),
              inArray(toolGatewaySessions.gatewayTokenId, revokedTokens.map((row) => row.id)),
              isNull(toolGatewaySessions.revokedAt),
            ))
            .returning({ id: toolGatewaySessions.id })).length;
        }
      }
    }

    // A local runtime already holds the injected credential inside a live child

View on GitHub (pinned to 01ad858492)

Solutions

  1. Reconnect the app to start a fresh OAuth authorization; the previous authorization grant expired.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/src/services/tool-access.ts:4441 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/5030278c25b96449. Report an issue: GitHub.