{"record":{"id":"0ef5e17a340d07c7","repo":"paperclipai/paperclip","slug":"agent-run-context-required","errorCode":null,"errorMessage":"Agent run context required","messagePattern":"Agent run context required","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"server/src/routes/decisions.ts","lineNumber":63,"sourceCode":"}\n\nfunction boardUserId(req: Parameters<typeof getActorInfo>[0]) {\n  assertBoard(req);\n  return req.actor.userId ?? \"local-implicit-board\";\n}\n\nexport function decisionRoutes(db: Db, options: DecisionServiceOptions) {\n  const router = Router();\n  const svc = decisionService(db, options);\n  router.post(\n    \"/companies/:companyId/decision-archive-proposals\",\n    validate(createDecisionArchiveProposalSchema),\n    async (req, res) => {\n      const companyId = req.params.companyId as string;\n      assertCompanyAccess(req, companyId);\n      const agent = agentContext(req);\n      if (!agent) {\n        res.status(403).json({ error: \"Agent run context required\" });\n        return;\n      }\n      const access = await authorizationService(db).decide({\n        actor: req.actor,\n        action: \"decision_triage:manage\",\n        resource: { type: \"company\", companyId },\n      });\n      if (!access.allowed) throw forbidden(access.explanation, authorizationDeniedDetails(access));\n\n      const proposal = req.body as CreateDecisionArchiveProposalInput;\n      const requested = new Map<string, CreateDecisionArchiveProposalInput[\"items\"][number]>(proposal.items.map((item) => [\n        `${item.sourceKind}:${item.sourceId}`,\n        item,\n      ]));\n      const found = new Map<string, AttentionItem>();\n      const snapshot = await db.transaction(async (tx) => attentionService(tx as unknown as Db).list(companyId, {\n        includeDismissed: true,\n        all: true,","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/decisions.ts#L45-L81","documentation":"Context guard in the decision-archive-proposal route: creating a decision archive proposal requires an authenticated agent run context (the proposing agent), but agentContext(req) returned null — the caller is not a valid agent actor — so the proposal is refused.","triggerScenarios":"Thrown at server/src/routes/decisions.ts:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include the required field(s) in the request path, query, or body as named by the error message, then retry.","Check the API contract in packages/shared validators for the exact required shape of this endpoint."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}