paperclipai/paperclip · error

Board user context required

Error message

Board user context required

What it means

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.

Source

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

  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;
}

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;

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Include the required field(s) in the request path, query, or body as named by the error message, then retry.
  2. Check the API contract in packages/shared validators for the exact required shape of this endpoint.
Defensive patterns

Strategy: validation

When it happens

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