JuliusBrussee/caveman · error · Error

tool catalog names must be non-empty and unique

Error message

tool catalog names must be non-empty and unique

What it means

Error "tool catalog names must be non-empty and unique" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/sdk/typescript/src/index.ts:1620

    headers: headers(cave, workflow),
    body: JSON.stringify(body)
  });
	if (!response.ok) throw new Error(`tool search failed with HTTP ${response.status}`);
  const data = await response.json();

  // Map snake_case response to camelCase
  const rawSent = strictNonNegativeInt(data.sent_schema_tokens);
  const rawFull = strictNonNegativeInt(data.full_schema_tokens);
  const validCounts = rawSent !== null && rawFull !== null && rawSent <= rawFull;
  const sentSchemaTokens = validCounts ? rawSent : 0;
  const fullSchemaTokens = validCounts ? rawFull : 0;
  const savedTokens = fullSchemaTokens - sentSchemaTokens;
  const reductionPct = fullSchemaTokens === 0 ? 0 : Math.round((savedTokens / fullSchemaTokens) * 1000) / 10;

  const catalogByName = new Map<string, CaveTool>();
  for (const tool of catalog) {
    if (typeof tool.name !== "string" || tool.name.trim() === "" || catalogByName.has(tool.name)) {
      throw new Error("tool catalog names must be non-empty and unique");
    }
    catalogByName.set(tool.name, tool);
  }
  if (!Array.isArray(data.tools)) throw new Error("tool search response tools must be an array");
  const returnedNames = new Set<string>();
  const selectedTools = data.tools.map((wire: unknown) => {
    const name = wire !== null && typeof wire === "object" && typeof (wire as Record<string, unknown>)["name"] === "string"
      ? (wire as Record<string, unknown>)["name"] as string
      : "";
    const local = catalogByName.get(name);
    if (!local || returnedNames.has(name)) throw new Error("tool search response contained an unknown or duplicate tool");
    returnedNames.add(name);
    return local;
  });

  return {
    sessionId: typeof data.session_id === "string" ? data.session_id : undefined,
    tools: selectedTools,

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Give every catalog tool a non-empty, unique name.

When it happens

Trigger: Thrown at packages/sdk/typescript/src/index.ts:1620 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/59923e0f7ce2feb2. Report an issue: GitHub.