paperclipai/paperclip · error · ToolGatewayHttpError

session_invalid

session_invalid

Error message

Tool gateway session is expired or invalid

What it means

401 sentinel thrown after writeSessionAuthFailure logged a session_run_inactive event: the gateway session token itself is well-formed, but the run it authenticates for is no longer active, so the session is treated as expired/invalid and the client must re-authenticate against a new run.

Source

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

    session?: ToolGatewaySession | null;
    companyId: string;
    agentId: string | null;
    runId: string | null;
    issueId: string | null;
    actorType?: LogActivityInput["actorType"];
    actorId?: string;
    action: string;
    details: Record<string, unknown>;
  }) {
    const dedicatedAuditAction =
      input.action === "tool_gateway.discovery"
        ? "discovery"
        : input.action === "tool_gateway.session_revoked"
          ? "session_revoked"
          : input.action === "tool_gateway.call_allowed" || input.action === "tool_gateway.session_created"
          ? "policy_decision"
          : input.action === "tool_gateway.call_completed"
            ? "call_completed"
            : input.action === "tool_gateway.call_denied" || input.action === "tool_gateway.session_rejected"
              ? "call_denied"
              : input.action === "tool_gateway.call_deferred"
                ? "call_failed"
                : "call_failed";
    const dedicatedOutcome =
      input.action === "tool_gateway.session_revoked"
        ? "success"
        : input.action === "tool_gateway.call_denied" || input.action === "tool_gateway.session_rejected"
        ? "denied"
        : input.action === "tool_gateway.call_deferred"
          ? "timeout"
          : input.action === "tool_gateway.call_failed"
            ? "failure"
            : "success";
    try {
      await db.insert(toolAccessAuditEvents).values({
        companyId: input.companyId,

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:1264 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/74753f7f35cfe27d. Report an issue: GitHub.