{"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":1318,"sourceCode":"        companyId: input.companyId,\n        gatewayId: input.session?.gatewayId ?? (typeof input.details.gatewayId === \"string\" && uuidPattern.test(input.details.gatewayId) ? input.details.gatewayId : null),\n        gatewayTokenId: input.session?.gatewayTokenId && uuidPattern.test(input.session.gatewayTokenId)\n          ? input.session.gatewayTokenId\n          : typeof input.details.gatewayTokenId === \"string\" && uuidPattern.test(input.details.gatewayTokenId)\n            ? input.details.gatewayTokenId\n            : null,\n        gatewayPublicId: typeof input.details.gatewayPublicId === \"string\" ? input.details.gatewayPublicId : null,\n        clientName: typeof input.details.clientName === \"string\" ? input.details.clientName : null,\n        correlationId: typeof input.details.correlationId === \"string\" ? input.details.correlationId : null,\n        connectionId: typeof input.details.connectionId === \"string\" ? input.details.connectionId : null,\n        catalogEntryId: typeof input.details.catalogEntryId === \"string\" ? input.details.catalogEntryId : null,\n        actorType: input.actorType ?? input.session?.actorType ?? (input.agentId ? \"agent\" : \"system\"),\n        actorId: input.actorId ?? input.session?.actorId ?? input.agentId ?? input.session?.gatewayTokenId ?? input.companyId,\n        action: dedicatedAuditAction,\n        outcome: dedicatedOutcome,\n        reasonCode: typeof input.details.reasonCode === \"string\" ? input.details.reasonCode : null,\n        details: {\n          source: input.action,\n          agentId: input.agentId,\n          issueId: input.issueId,\n          projectId: input.session?.projectId ?? null,\n          runId: input.runId,\n          gatewaySessionId: input.session?.id ?? null,\n          identityContextId: input.session?.identityContextId ?? null,\n          gatewayId: input.session?.gatewayId ?? null,\n          gatewayPublicId: input.session?.gatewayPublicId ?? null,\n          gatewayName: input.session?.gatewayName ?? null,\n          gatewayTokenId: input.session?.gatewayTokenId ?? null,\n          ...input.details,\n        },\n      });\n    } catch (error) {\n      await recordToolRuntimeAuditWriteFailure(db, input.companyId);\n      throw error;\n    }\n","sourceCodeStart":1300,"sourceCodeEnd":1336,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L1300-L1336","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":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}