{"record":{"id":"8abf457b0fdbeb59","repo":"paperclipai/paperclip","slug":"notfoundmessage","errorCode":null,"errorMessage":"notFoundMessage","messagePattern":"notFoundMessage","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/src/routes/authz.ts","lineNumber":190,"sourceCode":" *     membership checks on non-safe methods) and returns the resource\n *\n * Usage:\n *\n *     const goal = await getAccessibleResource(req, res, svc.getById(id), \"Goal not found\");\n *     if (!goal) return;\n *\n * Routes with bespoke not-found behavior (legacy `200 []` contracts,\n * audit-logged denials) should still compose `hasCompanyAccess` directly.\n */\nexport async function getAccessibleResource<T extends { companyId: string }>(\n  req: Request,\n  res: Response,\n  resource: T | null | undefined | Promise<T | null | undefined>,\n  notFoundMessage: string,\n): Promise<T | null> {\n  const resolved = await resource;\n  if (!resolved || !hasCompanyAccess(req, resolved.companyId)) {\n    res.status(404).json({ error: notFoundMessage });\n    return null;\n  }\n  assertCompanyAccess(req, resolved.companyId);\n  return resolved;\n}\n\nexport function getActorInfo(req: Request): (\n  {\n    actorType: \"agent\";\n    actorId: string;\n    agentId: string | null;\n    runId: string | null;\n    agentApiKeyId: string | null;\n    actorSource: \"agent_key\" | \"agent_jwt\";\n  }\n  | {\n    actorType: \"user\";\n    actorId: string;","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/routes/authz.ts#L172-L208","documentation":"Error \"notFoundMessage\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at server/src/routes/authz.ts:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the id in the request path or body refers to an existing record in this company; re-list the parent collection to get a valid id.","Check that the record was not deleted or archived, and that the request is scoped to the correct companyId."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}