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:
1. NoSuchToolError is usually a naming mismatch: the model pluralized, snake_cased, or hallucinated a tool. Clear descriptions and distinct names reduce it.
2. InvalidToolInputError carries the zod validation failure. Log it during development; it tells you exactly which field the model got wrong.
3. 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.
4. 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.
5. 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.
6. 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.