{"record":{"id":"31f34c5fa1bd0570","repo":"paperclipai/paperclip","slug":"session-revoked","errorCode":"session_revoked","errorMessage":"Tool gateway session is expired or invalid","messagePattern":"Tool gateway session is expired or invalid","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":401,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":1820,"sourceCode":"        const [candidate] = await db\n          .select()\n          .from(toolGatewaySessions)\n          .where(eq(toolGatewaySessions.id, sessionId))\n          .limit(1);\n        if (candidate) {\n          await writeSessionAuthFailure(candidate, \"session_invalid\");\n        }\n      }\n      throw new ToolGatewayHttpError(\n        401,\n        \"Tool gateway session is expired or invalid\",\n        \"session_invalid\",\n      );\n    }\n\n    if (row.revokedAt) {\n      await writeSessionAuthFailure(row, \"session_revoked\");\n      throw new ToolGatewayHttpError(\n        401,\n        \"Tool gateway session is expired or invalid\",\n        \"session_revoked\",\n      );\n    }\n\n    if (row.expiresAt.getTime() <= Date.now()) {\n      await writeSessionAuthFailure(row, \"session_expired\");\n      throw new ToolGatewayHttpError(\n        401,\n        \"Tool gateway session is expired or invalid\",\n        \"session_expired\",\n      );\n    }\n\n    await assertSessionRunIsActive(row);\n\n    const now = new Date();","sourceCodeStart":1802,"sourceCodeEnd":1838,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L1802-L1838","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:1300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-establish the tool gateway session (re-authenticate); the session token expired or is invalid."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}