{"record":{"id":"378ccc0089cbaee8","repo":"paperclipai/paperclip","slug":"decision-training-example-not-found","errorCode":null,"errorMessage":"Decision training example not found","messagePattern":"Decision training example not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/src/routes/decision-training.ts","lineNumber":38,"sourceCode":"  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;\n  }\n  return true;\n}\n\nexport function decisionTrainingRoutes(db: Db) {\n  const router = Router();\n  const svc = decisionTrainingService(db);\n\n  router.post(","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/decision-training.ts#L20-L56","documentation":"Deliberate 404 in parseExampleId: the path's example id fails UUID validation, so it cannot match any stored example; returning the not-found error (rather than 400) keeps invalid ids indistinguishable from nonexistent ones.","triggerScenarios":"Thrown at server/src/routes/decision-training.ts:38 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":"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"}