paperclipai/paperclip · error · ToolGatewayHttpError

session_run_inactive

session_run_inactive

Error message

Tool gateway session is expired or invalid

What it means

assertSessionRunIsActive found that the heartbeat run backing a gateway session no longer exists, changed company/agent ownership, or left ACTIVE_GATEWAY_RUN_STATUSES. The session is recorded as an auth failure (session_run_inactive) and rejected because tool calls may only flow while their originating run is active.

Source

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

        .select({ companyId: projects.companyId })
        .from(projects)
        .where(eq(projects.id, projectId))
        .limit(1);
      if (!project || project.companyId !== input.companyId) {
        throw new ToolGatewayHttpError(403, "Project context is outside the run company", "run_context_mismatch");
      }
    }
    return {
      issueId,
      projectId,
    };
  }

  async function writeAudit(input: {
    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"

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: validation

When it happens

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