{"record":{"id":"5c823160f304897f","repo":"paperclipai/paperclip","slug":"invalid-decision-filters","errorCode":null,"errorMessage":"Invalid decision filters","messagePattern":"Invalid decision filters","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/routes/decisions.ts","lineNumber":151,"sourceCode":"        additionalTargetSnapshots: targetSnapshots,\n      });\n      res.status(201).json(created);\n    },\n  );\n  router.post(\"/companies/:companyId/decisions\", validate(createSchema), async (req, res) => {\n    const companyId = req.params.companyId as string; assertCompanyAccess(req, companyId);\n    const agent = agentContext(req); if (!agent) { res.status(403).json({ error: \"Agent run context required\" }); return; }\n    res.status(201).json(await svc.create({ companyId, actor: req.actor, ...agent, ...req.body }));\n  });\n  router.post(\"/companies/:companyId/decision-bundles\", validate(bundleSchema), async (req, res) => {\n    const companyId = req.params.companyId as string; assertCompanyAccess(req, companyId);\n    const agent = agentContext(req); if (!agent) { res.status(403).json({ error: \"Agent run context required\" }); return; }\n    res.status(201).json(await svc.createBundle({ companyId, actor: req.actor, ...agent, ...req.body }));\n  });\n  router.get(\"/companies/:companyId/decisions\", async (req, res) => {\n    const companyId = req.params.companyId as string; assertBoard(req); assertCompanyAccess(req, companyId);\n    const query = z.object({ status: z.enum([\"open\", \"decided\", \"expired\", \"cancelled\"]).optional(), bundleId: z.string().guid().optional(), targetIssueId: z.string().guid().optional(), originAgentId: z.string().guid().optional(), limit: z.coerce.number().int().positive().max(100).optional() }).safeParse(req.query);\n    if (!query.success) { res.status(400).json({ error: \"Invalid decision filters\", details: query.error.flatten() }); return; }\n    res.json(await svc.list(companyId, query.data));\n  });\n  /**\n   * Gardener telemetry contract:\n   * { groupBy: \"ruleKey\", filters: { originAgentId: string|null, since: ISO-8601|null },\n   *   totals: { proposed, accepted, rejected, expired },\n   *   groups: [{ ruleKey: string|null, proposed, accepted, rejected, expired,\n   *     chosenOptions: [{ optionId, count }] }] }\n   * Accepted means a non-dismissed decided outcome; rejected means an explicit dismiss;\n   * chosenOptions counts accepted outcomes only; expired is separate, and cancelled\n   * decisions contribute only to proposed.\n   */\n  router.get(\"/companies/:companyId/decisions/stats\", async (req, res) => {\n    const companyId = req.params.companyId as string; assertBoardOrAgent(req); assertCompanyAccess(req, companyId);\n    const query = statsQuerySchema.safeParse(req.query);\n    if (!query.success) { res.status(400).json({ error: \"Invalid decision stats filters\", details: query.error.flatten() }); return; }\n    if (req.actor.type === \"agent\" && query.data.originAgentId && query.data.originAgentId !== req.actor.agentId) {\n      res.status(403).json({ error: \"Agents may only read their own decision stats\" }); return;","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/decisions.ts#L133-L169","documentation":"400 from the decision list routes. Generic validation-guard sentinel: fires when query filters for listing decisions (date range, kind, status etc.) fail schema parsing, so the handler rejects the request before querying.","triggerScenarios":"Thrown at server/src/routes/decisions.ts:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the offending parameter to satisfy the constraint stated in the error message (type, range, or allowed values), then retry.","Refer to the route's request validation in the named file and the shared validators for the accepted format."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-21T17:58:32.592Z","contentChangedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}