Qwen Code Tool Call Not Working? Fix Execution Errors

Qwen Code can print a tool-shaped response without executing anything, or reject the next request because a tool call has no matching tool response. The visible output may look correct while the model, serving template, or message history is incompatible.

Preserve first: Save the raw response and exact error, Qwen Code version, backend, model, and chat template. Test one read-only tool: text resembling a tool call is not proof of execution.

Match the failure before retrying.

Tool call appears as text

The model may describe or print a tool call while the serving layer returns no structured tool-call metadata. Qwen Code then has nothing it can execute.

Local template is incompatible

LM Studio, Ollama, or another local server may use a chat template without the tool-use structure expected by the model and client. Changing only the model may leave the same failure.

400 missing tool response

If the error says a message with tool_calls must be followed by responses for every tool_call_id, the conversation history contains an orphaned call. Preserve project state and test from a clean session.

Windows command never runs

First prove that a harmless tool can execute. If structured calls work but shell commands fail, isolate the PowerShell or command payload instead of changing the whole model stack.

Safe recovery path.

Preserve the task. Capture Git state, the exact error, raw model output, Qwen Code version, backend version, model name, template, and operating system.
Run one harmless tool test. Ask for a read-only operation and confirm the backend returns structured tool-call metadata, not only prose that resembles a call.
Fix the matching layer. Update or select a tool-capable serving template for text-only calls. For an orphaned tool_call_id error, start a clean conversation after preserving the task.
Resume from verified state. Inspect the Git diff and pass only confirmed changes, the failed path, and one next command into the clean session.

Do not mix all tool failures together.

A text-only tool call points to the model or serving template. A 400 naming missing tool_call_id responses points to message history. A structured call that reaches Qwen Code but fails only on Windows points to the command payload or shell. Change one layer at a time and repeat the same harmless test.

What the next AI should receive.

Name the backend, model, template, operating system, structured tool-call metadata, missing tool_call_id if returned, and the read-only test result. Distinguish generated text from commands that actually executed.

How ShardStitch works with Qwen Code.

ShardStitch preserves the coding task while you repair Qwen Code's tool path. The continuation packet names what reached disk, what the model only claimed, and the next safe execution step.

Source trail.

The Qwen reports below describe model/tool-call compatibility and request validation separately.

FAQ.

How do I distinguish a template problem from broken message history?

Text-only tool output points toward the model or serving template. A response naming a missing tool_call_id points toward call/result pairing in history. Use the exact response to choose which layer to test.

Should I change the model and shell together?

No. Repeat the same harmless test while changing one layer at a time. First establish structured calls; then isolate shell failures if execution reaches the client.

Scope note: Local-model tool behavior depends on the model, serving backend, chat template, Qwen Code version, and operating system.