A chat template bug makes GLM-5.1 loop on tool calls
- Source
- x.com
- Date

GLM-5.1 Tool Calling Issue Fix & Chat Template Update If you are running GLM-5.1 with vLLM/SGLang and using tool calling, please update your chat template. https://t.co/XyyCucws82 Issue When using tool calling, frameworks including vLLM automatically convert plain-text tool message content into an array of content parts (`[{"type": "text", "text": "..."}]`) before passing it to the chat template. The original template only supported string-formatted tool content, causing array-formatted tool outputs to render empty. As a result, the model does not receive tool results and repeatedly triggers the same tool call in a loop. Affected Models All GLM-5.1 variants deployed with vLLM or SGLang. Fix Simply replace your existing `chat_template.jinja` with the updated version from the repository.
Context
Z.ai traced a GLM-5.1 tool-call loop to a formatting mismatch that hid tool results from the model. Serving software could pass a tool's reply as a collection of text parts, while the original chat template expected a plain string. According to the bug notice, that mismatch rendered the result empty, causing the model to request the same tool again.
The prescribed fix was to replace chat_template.jinja for affected vLLM or SGLang deployments. The repository template handles both strings and text-part collections, preserving the information the model needs to continue after a tool responds.
postWe’re sharing how GLM-5.3 helped build and optimize the inference infrastructure serving GLM-5.3-Flash.- postGLM-5 lands in Zhipu's Coding Plan Pro as pricing shifts
articleZ.ai details GLM-5.3's leap in exploit analysis and staged release
postGLM-5.3 API launches for coding and cybersecurity agentic tasks
Checking sign-in…
Loading comments…


