# langchain_core.exceptions.ToolException: Tool 'search_tool' called with missing required arguments. Expected: ['query'], got: [].

- **ID:** `llm/langchain-tool-call-missing-arguments`
- **Domain:** llm
- **Category:** runtime_error
- **Error Code:** `LANG-ERR-0078`
- **Verification:** ai_generated
- **Fix Rate:** 76%

## Root Cause

The LLM generates a tool call with an empty arguments dict or missing required parameters, often due to the model misinterpreting the tool schema or truncating the function call JSON during streaming.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| langchain==0.3.0 | active | — | — |
| langchain-core==0.3.5 | active | — | — |
| langchain-openai==0.2.0 | active | — | — |

## Workarounds

1. **Implement a validation wrapper that catches ToolException and re-prompts the LLM with a correction message: `try: result = tool.run(tool_call) except ToolException: corrected_call = llm.invoke("The previous tool call was invalid. Please provide valid arguments for 'search_tool' with a 'query' string.")`. This allows the model to self-correct.** (85% success)
   ```
   Implement a validation wrapper that catches ToolException and re-prompts the LLM with a correction message: `try: result = tool.run(tool_call) except ToolException: corrected_call = llm.invoke("The previous tool call was invalid. Please provide valid arguments for 'search_tool' with a 'query' string.")`. This allows the model to self-correct.
   ```
2. **Simplify the tool schema by using primitive types (str, int) instead of complex objects or enums. Example: change `query: Optional[str]` to `query: str = Field(description="...")` to make it required and explicit.** (80% success)
   ```
   Simplify the tool schema by using primitive types (str, int) instead of complex objects or enums. Example: change `query: Optional[str]` to `query: str = Field(description="...")` to make it required and explicit.
   ```
3. **Use LangChain's `StructuredTool` with `handle_tool_error=True` to automatically retry with a fallback message: `tool = StructuredTool.from_function(func=search, handle_tool_error=True)`.** (75% success)
   ```
   Use LangChain's `StructuredTool` with `handle_tool_error=True` to automatically retry with a fallback message: `tool = StructuredTool.from_function(func=search, handle_tool_error=True)`.
   ```

## Dead Ends

- **** — While helpful, verbose descriptions can confuse the LLM or lead to token limit issues. The root cause is often the model's inability to consistently produce valid JSON for complex schemas. (65% fail)
- **** — Deterministic settings reduce variability but don't fix the underlying schema parsing issue. The model may still generate malformed calls if the prompt or tool definitions are ambiguous. (70% fail)
- **** — Retrying the same request with the same configuration will likely produce the same error because the model's behavior is consistent for the same input. (90% fail)
