{"record":{"id":"38ee20b66ba19dea","repo":"musistudio/claude-code-router","slug":"resolve-retrieval-did-not-converge-on-any-valid-ca-38ee20","errorCode":null,"errorMessage":"Resolve retrieval did not converge on any valid catalog tools.","messagePattern":"Resolve retrieval did not converge on any valid catalog tools\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/mcp/toolhub-mcp.ts","lineNumber":1618,"sourceCode":"            summary,\n            workflowSketch\n          })\n        : selectedToolNames.length === 0\n          ? \"Your current answer resolved to zero valid catalog tools. Call the tree-sitter tool on a revised TypeScript workflow sketch before answering.\"\n          : undefined;\n      if (refinementFeedback) {\n        messages.push(responseMessage);\n        messages.push({ role: \"user\", content: refinementFeedback });\n        continue;\n      }\n      break;\n    }\n\n    const selectedToolNames = uniqueStrings([...latestResolvedFromAnalyzer, ...llmSelectedNames]).slice(0, topK);\n    if (selectedToolNames.length === 0) {\n      throw new Error(didCallAnalyzer || analyzerCallCount > 0\n        ? \"Resolve retrieval did not converge on any valid catalog tools after AST refinement.\"\n        : \"Resolve retrieval did not converge on any valid catalog tools.\");\n    }\n    if (!didCallAnalyzer || analyzerCallCount === 0) {\n      referencedTokens = uniqueStrings([...referencedTokens, ...selectedToolNames]);\n    }\n    if (didCallAnalyzer && analyzerCallCount === 0) {\n      throw new Error(\"Resolve retrieval LLM did not complete an AST planning round.\");\n    }\n    if (!summary) {\n      summary = didCallAnalyzer\n        ? \"Resolved a planned end-to-end tool bundle with AST-assisted retrieval.\"\n        : \"Resolved a planned end-to-end tool bundle from the resolver model response.\";\n    } else if (summary.toLowerCase().includes(\"no strong tool bundle match was found\")) {\n      summary = \"Resolved a candidate tool bundle after iterative AST refinement.\";\n    }\n    return {\n      plannedSteps: plannedSteps.length > 0 ? plannedSteps : undefined,\n      referencedTokens,\n      selectedToolNames,","sourceCodeStart":1600,"sourceCodeEnd":1636,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/mcp/toolhub-mcp.ts#L1600-L1636","documentation":"Thrown when the ToolHub resolve loop produced zero valid catalog tool names and no AST-analyzer round ever ran. This is the pure-LLM failure path: the resolver model's response contained no usable tool selections before any AST refinement was attempted.","triggerScenarios":"resolve() ends with empty selection sets and didCallAnalyzer/analyzerCallCount are both falsy — the first LLM completion returned no tool calls or only invalid names.","commonSituations":"Ambiguous or off-domain query so the model selects nothing; a weak model that answers in prose instead of tool_calls; prompt/model misconfiguration producing empty responses.","solutions":["Make the query more specific and domain-aligned with the catalog","Switch to a resolver model that reliably emits tool calls (set TOOLHUB_OPENAI_MODEL)","Check that the catalog actually contains candidate tools via search","Retry — occasional non-deterministic empty model responses can occur"],"exampleFix":"// before\nawait toolhub.resolve({ query: \"stuff\" });\n\n// after\nawait toolhub.resolve({ query: \"transcribe an audio file to text with speaker labels\", topK: 5 });","handlingStrategy":"retry","validationCode":"const candidates = await toolhub.search({ query, topK: 3 });\nif (candidates.results.length === 0) return { tools: [] }; // skip LLM resolve","typeGuard":null,"tryCatchPattern":"try {\n  return await toolhub.resolve({ query });\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"did not converge\")) {\n    await delay(1000);\n    return await toolhub.resolve({ query: clarify(query) }); // one retry with rephrase\n  }\n  throw e;\n}","preventionTips":["Rewrite vague queries into tool-shaped requests before resolving","Use a tool-calling-capable resolver model"],"tags":["toolhub","llm","retrieval","no-results"],"backgroundTag":"llm-no-valid-tool-match","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}