Qwen 3.8's official chat template is broken—this community fix restores it
Official Qwen 3.8 template crashes on thinking, tool calls, and multi-turn chats.
Qwen's first 3.8 model ships with a headline feature: prompt-steered reasoning effort. You can now tell the model how deeply to think by setting reasoning_effort to xhigh, medium, or low. But the official chat template is riddled with bugs that break real-world deployments. Passing enable_thinking=false throws a hard exception, so you can't disable reasoning for fast answers. The template also injects blank <think></think> tags into multi-turn history, poisoning the context. Tool calling crashes when arguments arrive as JSON strings—the standard OpenAI API format—and the template drops mid-dialogue system messages, stalling agent loops.
The community stepped in. Reddit user ex-arman68 (maintaining the Hugging Face repo froggeric/Qwen-Fixed-Chat-Templates) built a single drop-in Jinja template that fixes all of these issues across Qwen 3.5, 3.6, and 3.8. It supports full reasoning effort control, restores the thinking toggle via kwargs or an inline <|think_off|> token, and keeps past thoughts intact by default for 100% KV cache hits. It also handles both Python dicts and JSON string tool arguments, making it compatible with llama.cpp, vLLM, LM Studio, and MLX. The recommended llama-server command uses --reasoning-format deepseek to separate thoughts into the OpenAI reasoning_content field, preventing harnesses like OpenCode and Claude Code from stalling. The template passes 28 automated tests and tokenizer parity checks, though the author couldn't test against the full 2.4T-parameter Qwen 3.8 model due to hardware limits.
- Qwen 3.8 adds reasoning_effort control (xhigh, medium, low), but official template crashes with enable_thinking=false
- Fixed template restores thinking toggle, prevents <think> tag poisoning, and achieves 100% KV cache hits across turns
- Works across llama.cpp, vLLM, LM Studio, and MLX with universal tool parsing for dicts and JSON strings; passes 28 tests
Why It Matters
For LLM engineers, a broken chat template breaks agent loops and caching; this fix makes Qwen 3.8 production-ready.