paperclipai/paperclip · error · ToolGatewayHttpError

session_revoked

session_revoked

Error message

Tool gateway session is expired or invalid

What it means

getActiveSession could not load a session row for the presented token. If the token embeds a session id, a lookup of that candidate is attempted purely to record a session_invalid auth failure for auditing before the 401 is thrown; the input at fault is the bearer/session token, which is unknown, malformed, or already deleted.

Source

Thrown at server/src/services/tool-gateway.ts:1318

        companyId: input.companyId,
        gatewayId: input.session?.gatewayId ?? (typeof input.details.gatewayId === "string" && uuidPattern.test(input.details.gatewayId) ? input.details.gatewayId : null),
        gatewayTokenId: input.session?.gatewayTokenId && uuidPattern.test(input.session.gatewayTokenId)
          ? input.session.gatewayTokenId
          : typeof input.details.gatewayTokenId === "string" && uuidPattern.test(input.details.gatewayTokenId)
            ? input.details.gatewayTokenId
            : null,
        gatewayPublicId: typeof input.details.gatewayPublicId === "string" ? input.details.gatewayPublicId : null,
        clientName: typeof input.details.clientName === "string" ? input.details.clientName : null,
        correlationId: typeof input.details.correlationId === "string" ? input.details.correlationId : null,
        connectionId: typeof input.details.connectionId === "string" ? input.details.connectionId : null,
        catalogEntryId: typeof input.details.catalogEntryId === "string" ? input.details.catalogEntryId : null,
        actorType: input.actorType ?? input.session?.actorType ?? (input.agentId ? "agent" : "system"),
        actorId: input.actorId ?? input.session?.actorId ?? input.agentId ?? input.session?.gatewayTokenId ?? input.companyId,
        action: dedicatedAuditAction,
        outcome: dedicatedOutcome,
        reasonCode: typeof input.details.reasonCode === "string" ? input.details.reasonCode : null,
        details: {
          source: input.action,
          agentId: input.agentId,
          issueId: input.issueId,
          projectId: input.session?.projectId ?? null,
          runId: input.runId,
          gatewaySessionId: input.session?.id ?? null,
          identityContextId: input.session?.identityContextId ?? null,
          gatewayId: input.session?.gatewayId ?? null,
          gatewayPublicId: input.session?.gatewayPublicId ?? null,
          gatewayName: input.session?.gatewayName ?? null,
          gatewayTokenId: input.session?.gatewayTokenId ?? null,
          ...input.details,
        },
      });
    } catch (error) {
      await recordToolRuntimeAuditWriteFailure(db, input.companyId);
      throw error;
    }

View on GitHub (pinned to 01ad858492)

Solutions

  1. Re-establish the tool gateway session (re-authenticate); the session token expired or is invalid.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/src/services/tool-gateway.ts:1300 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/31f34c5fa1bd0570. Report an issue: GitHub.