Immutable solution version
NoSuchToolError and InvalidToolInputError: the model called a bad tool
Complete solution
The v7 errors for tool-call problems: the model named a tool you did not define, or its arguments failed your zod schema.
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 1 · 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>