Back Home

GitHub Repo

Ollama Community Reports Qwen Tool Parsing Bug That May Rewrite or Drop Code Arguments

On November 13, the Ollama community reported that the Qwen tool-call parser may rewrite code arguments and lose calls depending on how the stream is chunked. The report includes concrete reproduction cases, but no public fix PR or maintainer confirmation is available yet.

Mattruffoni · CC BY-SA 4.0 · Image source
zh-Hant

Ollama’s GitHub repository received a report of a tool-call parsing bug on November 13 involving the qwen3.5 and qwen3-coder parsers. The reporter said that, while testing a coding agent on Windows 11 with v0.40.15, valid calls could have their code arguments silently rewritten; some calls could also disappear depending on stream chunk boundaries. The issue remains open, with no linked fix PR so far. Issue report

One concrete case is the TypeScript type type Box<T=any>. The parser’s regular expression matches any <name=value> pattern and converts it to an XML attribute, potentially changing the generic syntax to <T name="any">. Inspection of the main branch source confirms that this broad matching rule and replacement step are still present. As a result, a file-writing tool may receive content that differs from the model’s original output, even when the model emitted a valid string. Parser source code

Other cases involve confusion between control markers and data: the report says a literal </tool_call> inside an argument can cause the collector to end the call early; thinking text containing <tool_call>, or a model omitting </think>, can change how text is classified depending on chunking, and may even cause a genuine tool call to be treated as thinking content. The report also notes that an empty final chunk does not forward the end signal, which may leave a pending call without a result. Trigger conditions

This directly affects agent loops. Ollama’s official documentation instructs streaming clients to collect thinking, content, and tool_calls, then send them back to the model along with tool results. If the server has already misclassified fields or rewritten arguments, a client that simply concatenates chunks cannot restore the data. Based on this, engineering teams should include generic syntax, literal control markers, and varied chunk boundaries in integration tests, and compare the content actually received by tools. Official tool-calling documentation

The reporter proposed narrowing marker matching, validating end markers, and forwarding the stream termination signal, but has not provided public test code to support the claim that the tests pass. This review also did not independently reproduce the issue. Follow-up should track maintainer confirmation, public regression tests, and the versions covered by any official release; teams should not assume that disabling streaming avoids every case.

Sources

  1. Qwen parsers: tool-call arguments corrupted or calls lost depending on content and stream chunking
  2. Ollama Qwen3-Coder parser source
  3. Tool calling — Ollama