paperclipai/paperclip · error

Invalid decision training query

Error message

Invalid decision training query

What it means

Query-schema guard on the decision-training list route: the query string failed the project/kind/author/q Zod schema (bad UUID, overlong q, unknown param), so the list request is rejected with 400 instead of running an unfiltered or malformed query.

Source

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

        cutoffAt: preview.cutoffAt.toISOString(),
        decisionOutcome: preview.decisionOutcome,
        snapshot: preview.snapshot,
      });
    },
  );

  router.get("/companies/:companyId/decision-training", async (req, res) => {
    const companyId = req.params.companyId as string;
    assertBoard(req);
    assertCompanyAccess(req, companyId);
    const parsed = z.object({
      project: z.string().guid().optional(),
      kind: sourceKindSchema.optional(),
      author: z.string().optional(),
      q: z.string().trim().max(500).optional(),
    }).safeParse(req.query);
    if (!parsed.success) {
      res.status(400).json({ error: "Invalid decision training query", details: parsed.error.flatten() });
      return;
    }
    res.json(await svc.list(companyId, {
      projectId: parsed.data.project,
      kind: parsed.data.kind,
      author: parsed.data.author,
      q: parsed.data.q,
    }));
  });

  router.get("/companies/:companyId/decision-training/export.jsonl", async (req, res) => {
    const companyId = req.params.companyId as string;
    assertBoard(req);
    assertCompanyAccess(req, companyId);
    const rows = await svc.list(companyId);
    const body = rows
      .map(({ example }) => JSON.stringify({
        retentionPolicy: example.retentionPolicy,

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Fix the offending parameter to satisfy the constraint stated in the error message (type, range, or allowed values), then retry.
  2. Refer to the route's request validation in the named file and the shared validators for the accepted format.
Defensive patterns

Strategy: validation

When it happens

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