paperclipai/paperclip · error · ToolGatewayHttpError

session_not_found

session_not_found

Error message

Tool gateway session not found

What it means

Session revocation/management lookup: no toolGatewaySessions row exists for the supplied sessionId within the given company. The 404 fires on the company-scoped select before any revocation or mutation happens, covering deleted sessions and cross-company session ids.

Source

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

      const tools = await connectedMcpToolsForConnection(input.companyId, input.connectionId);
      const decisions = await Promise.all(tools.map(async (tool) => {
        const decision = await policyService.decide(policyInputForAgentTool({
          companyId: input.companyId,
          agentId: input.agentId,
          tool,
        }));
        const testDecision =
          decision.decision === "require_approval"
            ? "ask_first"
            : decision.allowed
              ? "allowed"
              : "off";
        return {
          toolName: tool.upstreamToolName ?? tool.name,
          gatewayToolName: tool.name,
          displayName: tool.displayName,
          risk: tool.risk,
          decision: testDecision,
          reasonCode: decision.reasonCode,
          matchedPolicyIds: decision.matchedPolicyIds,
          effectiveProfileIds: decision.effectiveProfileIds,
        };
      }));
      const lastChange = await summarizeAccessLastChange({
        companyId: input.companyId,
        connectionId: input.connectionId,
        agentId: input.agentId,
        policyIds: [...new Set(decisions.flatMap((decision) => decision.matchedPolicyIds))],
        profileIds: [...new Set(decisions.flatMap((decision) => decision.effectiveProfileIds))],
      });
      return {
        connectionId: input.connectionId,
        toolCount: decisions.length,
        allowedCount: decisions.filter((decision) => decision.decision === "allowed").length,
        askFirstCount: decisions.filter((decision) => decision.decision === "ask_first").length,
        offCount: decisions.filter((decision) => decision.decision === "off").length,

View on GitHub (pinned to 01ad858492)

Solutions

  1. Verify the gateway session ID; it may have expired or been closed. Re-establish the session.
Defensive patterns

Strategy: validation

When it happens

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