{"record":{"id":"769d0d76924c81af","repo":"paperclipai/paperclip","slug":"decision-training-writes-require-a-human-user","errorCode":null,"errorMessage":"Decision training writes require a human user","messagePattern":"Decision training writes require a human user","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"server/src/routes/decision-training.ts","lineNumber":25,"sourceCode":"\nconst sourceKindSchema = z.enum([\"interaction\", \"approval\", \"execution_decision\"]);\nconst exampleIdSchema = z.string().guid();\nconst createSchema = z.object({\n  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","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/decision-training.ts#L7-L43","documentation":"Actor-type gate in the decision-training routes: writes to decision-training examples must be attributed to a human board user, but the request actor is an agent (or another non-board type), so the write is refused with 403 before validation.","triggerScenarios":"Thrown at server/src/routes/decision-training.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the request so it satisfies the condition stated in the error message, then retry; see the throwing line in the named file for the exact check."],"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"}