Solution skill
NoSuchToolError and InvalidToolInputError: the model called a bad tool
Complete solution
Shows how to fix noSuchToolError and InvalidToolInputError: the model called a bad tool. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
InvalidToolInputError: the name exists but the arguments failed validation. import { InvalidToolInputError, NoSuchToolError, generateText, tool } from 'ai'; const result = await generateText({ model: 'your-model-id', tools: { getWeather: tool({ /... / }) }, prompt: 'Weather?', }); // NoSuchToolError if the model calls get_weather instead of getWeather What to know: 1.
When to use
You are seeing this: Two distinct failures, one confusing moment. Use this skill when you run into "NoSuchToolError and InvalidToolInputError: the model called a bad tool".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Two distinct failures, one confusing moment. NoSuchToolError: the model called a tool name that is not in your tools map. InvalidToolInputError: the name exists but the arguments failed validation.
import { InvalidToolInputError, NoSuchToolError, generateText, tool } from 'ai';
const result = await generateText({ model: 'your-model-id', tools: { getWeather: tool({ / ... / }) }, prompt: 'Weather?', }); // NoSuchToolError if the model calls get_weather instead of getWeather
What to know:
- NoSuchToolError is usually a naming mismatch: the model pluralized, snake_cased, or hallucinated a tool. Clear descriptions and distinct names reduce it.
- InvalidToolInputError carries the zod validation failure. Log it during development; it tells you exactly which field the model got wrong.
- For flaky tool args, use repairToolCall (experimental_repairToolCall in older versions) to fix malformed calls instead of failing the whole generation. ToolCallRepairError fires when the repair itself fails.
- activeTools (stable since v5, no longer experimental) limits which tools the model can see on a given step. Fewer visible tools means fewer wrong-tool calls.
- If the model keeps calling a removed tool, you are probably sending stale messages containing the old tool definition, or a cached prompt. Check the messages array, not the tools map.
- Strict tool calling (strict: true on the tool, where supported) makes the provider validate args server-side, catching some invalid inputs before they reach you.
Evidence
Verified against the live AI SDK docs 2026-09-26. The errors reference lists NoSuchToolError, InvalidToolInputError, and ToolCallRepairError under tools and approvals. The v7 migration codemod table documents the experimental_ prefix removals including activeTools. The tools-and-tool-calling guide documents the tool() helper with inputSchema and strict.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_6Rjvg8YeoBXJ1dynG5jNRA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">NoSuchToolError and InvalidToolInputError: the model called a bad tool <span>— Vectle</span></a>