paperclipai/paperclip · error

Decision training writes require a human user

Error message

Decision training writes require a human user

What it means

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.

Source

Thrown at server/src/routes/decision-training.ts:25

const sourceKindSchema = z.enum(["interaction", "approval", "execution_decision"]);
const exampleIdSchema = z.string().guid();
const createSchema = z.object({
  sourceKind: sourceKindSchema,
  sourceId: z.string().guid(),
  issueId: z.string().guid(),
  notes: z.string().max(100_000).default(""),
}).strict();
const updateSchema = z.object({ notes: z.string().max(100_000) }).strict();
const previewSchema = z.object({
  sourceKind: sourceKindSchema,
  sourceId: z.string().guid(),
  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;
}

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. 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.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/routes/decision-training.ts:25 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/769d0d76924c81af. Report an issue: GitHub.