{"record":{"id":"7445436ccc56ee9c","repo":"paperclipai/paperclip","slug":"board-user-context-required-744543","errorCode":null,"errorMessage":"Board user context required","messagePattern":"Board user context required","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"server/src/routes/decision-training.ts","lineNumber":29,"sourceCode":"  sourceKind: sourceKindSchema,\n  sourceId: z.string().guid(),\n  issueId: z.string().guid(),\n  notes: z.string().max(100_000).default(\"\"),\n}).strict();\nconst updateSchema = z.object({ notes: z.string().max(100_000) }).strict();\nconst previewSchema = z.object({\n  sourceKind: sourceKindSchema,\n  sourceId: z.string().guid(),\n  issueId: z.string().guid(),\n}).strict();\n\nfunction requireHumanUser(req: Request, res: Response) {\n  if (req.actor.type !== \"board\") {\n    res.status(403).json({ error: \"Decision training writes require a human user\" });\n    return null;\n  }\n  if (!req.actor.userId) {\n    res.status(403).json({ error: \"Board user context required\" });\n    return null;\n  }\n  return req.actor.userId;\n}\n\nfunction parseExampleId(req: Request, res: Response) {\n  const parsed = exampleIdSchema.safeParse(req.params.id);\n  if (!parsed.success) {\n    res.status(404).json({ error: \"Decision training example not found\" });\n    return null;\n  }\n  return parsed.data;\n}\n\nfunction requireExampleOwner(res: Response, userId: string, createdByUserId: string) {\n  if (userId !== createdByUserId) {\n    res.status(403).json({ error: \"Only the example author can change decision training examples\" });\n    return false;","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/decision-training.ts#L11-L47","documentation":"Identity gate in the decision-training routes: the actor is board-typed but carries no userId (e.g. an implicit/system board context without an authenticated user), so the example cannot be attributed to an author and the write is refused with 403.","triggerScenarios":"Thrown at server/src/routes/decision-training.ts:29 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-14T05:17:10.506Z"}