{"record":{"id":"3308079458cd1191","repo":"JuliusBrussee/caveman","slug":"unknown-report-report","errorCode":null,"errorMessage":"unknown report: ${report}","messagePattern":"unknown report: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/agent-mcp.ts","lineNumber":561,"sourceCode":"    const args = objectArg(rawArgs);\n    const allowed = TOOL_ARGUMENT_KEYS[name];\n    const unknown = Object.keys(args).filter((key) => !allowed?.has(key));\n    if (unknown.length > 0) throw new Error(`unknown argument(s): ${unknown.sort().join(\", \")}`);\n    let value: JSONValue;\n    switch (name) {\n      case \"caveman_context\": {\n        const [identity, projects, selectedProjectId] = await Promise.all([\n          client.request(\"/api/v1/auth/me\"),\n          client.request(\"/api/v1/projects\"),\n          client.projectId(),\n        ]);\n        value = { identity, projects, selected_project_id: selectedProjectId };\n        break;\n      }\n      case \"caveman_report\": {\n        const report = stringArg(args, \"report\");\n        const reportPath = REPORT_PATHS[report];\n        if (!reportPath) throw new Error(`unknown report: ${report}`);\n        value = await client.request(await withProjectQuery(client, reportPath));\n        break;\n      }\n      case \"caveman_plan\": {\n        value = await client.request(`/api/v1/projects/${encodeURIComponent(await client.projectId())}/cave-plan`);\n        break;\n      }\n      case \"caveman_trace_search\": {\n        validateTraceSearch(args);\n        const projectId = await client.projectId();\n        value = await client.request(`/api/v1/traces/search?${new URLSearchParams({ project_id: projectId })}`, {\n          method: \"POST\",\n          body: args,\n        });\n        break;\n      }\n      case \"caveman_trace_get\": {\n        const traceId = encodeURIComponent(stringArg(args, \"trace_id\"));","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/agent-mcp.ts#L543-L579","documentation":"Dispatch error in the MCP callTool handler: the requested report name does not match any report the tool knows how to produce. The report identifier (a free-form string from the client) is echoed in the message; only the enumerated report set is valid.","triggerScenarios":"stringArg(args,\"report\") returns a name not present in REPORT_PATHS, e.g. caveman_report with {report:\"weekly-summary\"} when only fixed report keys exist.","commonSituations":"Agents guessing report names; documentation drift after reports were renamed or removed; capitalization or pluralization mismatches.","solutions":["Use one of the exact report names defined in REPORT_PATHS","List valid names by inspecting REPORT_PATHS in packages/cli/src/agent-mcp.ts","If a report was renamed, update the calling prompt/agent","If you need a new report, add a mapping to REPORT_PATHS rather than passing an arbitrary name"],"exampleFix":"// before\nawait callTool(client, \"caveman_report\", { report: \"weekly-summary\" });\n// after\nawait callTool(client, \"caveman_report\", { report: \"caveman-compress\" });","handlingStrategy":"validation","validationCode":"const report = args.report;\nif (typeof report !== \"string\" || !(report in REPORT_PATHS)) throw new Error(\"pick a report from REPORT_PATHS keys: \" + Object.keys(REPORT_PATHS).join(\", \"));","typeGuard":"function isKnownReport(r: string): r is keyof typeof REPORT_PATHS { return r in REPORT_PATHS; }","tryCatchPattern":"try { ... } catch (e) { if (e.message.startsWith(\"unknown report:\")) { console.error(Object.keys(REPORT_PATHS)); } }","preventionTips":["Keep the report name list in your agent prompt in sync with REPORT_PATHS","Use keyof typeof REPORT_PATHS typing so typos fail at compile time","Never let an LLM free-form the report name — offer a fixed choice"],"tags":["validation","cli","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}