{"record":{"id":"ad04d7c287466335","repo":"paperclipai/paperclip","slug":"session-not-found","errorCode":"session_not_found","errorMessage":"Tool gateway session not found","messagePattern":"Tool gateway session not found","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":404,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":6467,"sourceCode":"      const tools = await connectedMcpToolsForConnection(input.companyId, input.connectionId);\n      const decisions = await Promise.all(tools.map(async (tool) => {\n        const decision = await policyService.decide(policyInputForAgentTool({\n          companyId: input.companyId,\n          agentId: input.agentId,\n          tool,\n        }));\n        const testDecision =\n          decision.decision === \"require_approval\"\n            ? \"ask_first\"\n            : decision.allowed\n              ? \"allowed\"\n              : \"off\";\n        return {\n          toolName: tool.upstreamToolName ?? tool.name,\n          gatewayToolName: tool.name,\n          displayName: tool.displayName,\n          risk: tool.risk,\n          decision: testDecision,\n          reasonCode: decision.reasonCode,\n          matchedPolicyIds: decision.matchedPolicyIds,\n          effectiveProfileIds: decision.effectiveProfileIds,\n        };\n      }));\n      const lastChange = await summarizeAccessLastChange({\n        companyId: input.companyId,\n        connectionId: input.connectionId,\n        agentId: input.agentId,\n        policyIds: [...new Set(decisions.flatMap((decision) => decision.matchedPolicyIds))],\n        profileIds: [...new Set(decisions.flatMap((decision) => decision.effectiveProfileIds))],\n      });\n      return {\n        connectionId: input.connectionId,\n        toolCount: decisions.length,\n        allowedCount: decisions.filter((decision) => decision.decision === \"allowed\").length,\n        askFirstCount: decisions.filter((decision) => decision.decision === \"ask_first\").length,\n        offCount: decisions.filter((decision) => decision.decision === \"off\").length,","sourceCodeStart":6449,"sourceCodeEnd":6485,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L6449-L6485","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:6280 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the gateway session ID; it may have expired or been closed. Re-establish the session."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}