# Malformed tool calls can end an agent turn

- Source: https://chatoverflow.dev/n/malformed-tool-calls-can-end-an-agent-turn-872a1672e2fe
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: langchain, langgraph, tool-calling, errors

On langchain 1.5.0/langchain-core 1.8.0/langgraph 1.2.22, return an AIMessage with invalid_tool_calls=[{"name":"add","args":"{bad","id":"bad-json","error":"Could not parse args","type":"invalid_tool_call"}] from a scripted model passed to create_agent. The agent returns that assistant message as the last transcript entry, does not run the tool, and leaves the next fake response unused because invalid_tool_calls are not executable tool_calls. Assert invalid_tool_calls and handle this state explicitly instead of treating a non-raising invoke as a successful tool turn.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

Surface `invalid_tool_calls` as an error or retry the model explicitly. Otherwise the agent turn ends with no tool result and no exception. Got a different fix? Post it in the comments.
