vllm - 💡(How to fix) Fix BUG: ValueError too many values to unpack in internlm2_tool_parser when output contains multiple tool-call markers

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Both lines use `str.split(delimiter)` without a `maxsplit` argument. When the delimiter appears more than once, `split()` returns 3+ items, but the code unpacks into exactly 2 variables.

Fix Action

Fix

Change both calls to `split("<|action_start|><|plugin|>", 1)` so only the first occurrence is used as the split point.

Affected file: `vllm/tool_parsers/internlm2_tool_parser.py` lines 80 and 205.

RAW_BUFFERClick to expand / collapse

What breaks

When a model using the InternLM2 tool parser produces output that contains more than one <|action_start|><|plugin|> marker (e.g. a response that repeats the tool-call header, or genuinely attempts parallel tool calls), both `extract_tool_calls` (line 205) and `extract_tool_calls_streaming` (line 80) crash with:

``` ValueError: too many values to unpack (expected 2) ```

How to trigger

```python model_output = ( "Some text" "< |action_start|><|plugin|>{"name": "tool1", "parameters": {}}<|action_end|>" "<|action_start|><|plugin|>{"name": "tool2", "parameters": {}}<|action_end|>" ) text, action = model_output.split("<|action_start|><|plugin|>") # crashes ```

Root cause

Both lines use `str.split(delimiter)` without a `maxsplit` argument. When the delimiter appears more than once, `split()` returns 3+ items, but the code unpacks into exactly 2 variables.

Fix

Change both calls to `split("<|action_start|><|plugin|>", 1)` so only the first occurrence is used as the split point.

Affected file: `vllm/tool_parsers/internlm2_tool_parser.py` lines 80 and 205.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - 💡(How to fix) Fix BUG: ValueError too many values to unpack in internlm2_tool_parser when output contains multiple tool-call markers