paperclipai/paperclip · error
Decision training example not found
Error message
Decision training example not found
What it means
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.
Source
Thrown at server/src/routes/decision-training.ts:38
issueId: z.string().guid(),
}).strict();
function requireHumanUser(req: Request, res: Response) {
if (req.actor.type !== "board") {
res.status(403).json({ error: "Decision training writes require a human user" });
return null;
}
if (!req.actor.userId) {
res.status(403).json({ error: "Board user context required" });
return null;
}
return req.actor.userId;
}
function parseExampleId(req: Request, res: Response) {
const parsed = exampleIdSchema.safeParse(req.params.id);
if (!parsed.success) {
res.status(404).json({ error: "Decision training example not found" });
return null;
}
return parsed.data;
}
function requireExampleOwner(res: Response, userId: string, createdByUserId: string) {
if (userId !== createdByUserId) {
res.status(403).json({ error: "Only the example author can change decision training examples" });
return false;
}
return true;
}
export function decisionTrainingRoutes(db: Db) {
const router = Router();
const svc = decisionTrainingService(db);
router.post(View on GitHub (pinned to a7e689b3c3)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/routes/decision-training.ts:38 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/378ccc0089cbaee8.
Report an issue: GitHub.