JuliusBrussee/caveman · error

unknown report

Error message

unknown report: ${report}

What it means

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.

Solutions

  1. Use one of the exact report names defined in REPORT_PATHS
  2. List valid names by inspecting REPORT_PATHS in packages/cli/src/agent-mcp.ts
  3. If a report was renamed, update the calling prompt/agent
  4. If you need a new report, add a mapping to REPORT_PATHS rather than passing an arbitrary name

Example fix

// before
await callTool(client, "caveman_report", { report: "weekly-summary" });
// after
await callTool(client, "caveman_report", { report: "caveman-compress" });
Defensive patterns

Strategy: validation

Validate before calling

const report = args.report;
if (typeof report !== "string" || !(report in REPORT_PATHS)) throw new Error("pick a report from REPORT_PATHS keys: " + Object.keys(REPORT_PATHS).join(", "));

Type guard

function isKnownReport(r: string): r is keyof typeof REPORT_PATHS { return r in REPORT_PATHS; }

Try / catch

try { ... } catch (e) { if (e.message.startsWith("unknown report:")) { console.error(Object.keys(REPORT_PATHS)); } }

Prevention

When it happens

Trigger: 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.

Common situations: Agents guessing report names; documentation drift after reports were renamed or removed; capitalization or pluralization mismatches.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/3308079458cd1191. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/agent-mcp.ts:561

    const args = objectArg(rawArgs);
    const allowed = TOOL_ARGUMENT_KEYS[name];
    const unknown = Object.keys(args).filter((key) => !allowed?.has(key));
    if (unknown.length > 0) throw new Error(`unknown argument(s): ${unknown.sort().join(", ")}`);
    let value: JSONValue;
    switch (name) {
      case "caveman_context": {
        const [identity, projects, selectedProjectId] = await Promise.all([
          client.request("/api/v1/auth/me"),
          client.request("/api/v1/projects"),
          client.projectId(),
        ]);
        value = { identity, projects, selected_project_id: selectedProjectId };
        break;
      }
      case "caveman_report": {
        const report = stringArg(args, "report");
        const reportPath = REPORT_PATHS[report];
        if (!reportPath) throw new Error(`unknown report: ${report}`);
        value = await client.request(await withProjectQuery(client, reportPath));
        break;
      }
      case "caveman_plan": {
        value = await client.request(`/api/v1/projects/${encodeURIComponent(await client.projectId())}/cave-plan`);
        break;
      }
      case "caveman_trace_search": {
        validateTraceSearch(args);
        const projectId = await client.projectId();
        value = await client.request(`/api/v1/traces/search?${new URLSearchParams({ project_id: projectId })}`, {
          method: "POST",
          body: args,
        });
        break;
      }
      case "caveman_trace_get": {
        const traceId = encodeURIComponent(stringArg(args, "trace_id"));

View on GitHub (pinned to 3ee70a1026)