vllm - ✅(Solved) Fix [Bug]: Qwen3.5 tool calling bug [1 pull requests, 6 comments, 3 participants]

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…
GitHub stats
vllm-project/vllm#36769Fetched 2026-04-08 00:34:57
View on GitHub
Comments
6
Participants
3
Timeline
25
Reactions
0
Assignees
Timeline (top)
commented ×6subscribed ×6mentioned ×3project_v2_item_status_changed ×3

Error Message

(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Error in extracting tool call from response. (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Traceback (most recent call last): (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 310, in extract_tool_calls (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] self._parse_xml_function_call(function_call_str, request.tools) (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 246, in _parse_xml_function_call (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] end_index = function_call_str.index(">") (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] ValueError: substring not found

Fix Action

Fix / Workaround

============================== CPU Info

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 20 On-line CPU(s) list: 0-19 Vendor ID: GenuineIntel BIOS Vendor ID: QEMU Model name: INTEL(R) XEON(R) PLATINUM 8568Y+ BIOS Model name: pc-q35-6.1 CPU @ 2.0GHz BIOS CPU family: 1 CPU family: 6 Model: 207 Thread(s) per core: 1 Core(s) per socket: 20 Socket(s): 1 Stepping: 2 BogoMIPS: 4600.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq dtes64 vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd arat vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk avx512_fp16 arch_capabilities Virtualization: VT-x Hypervisor vendor: KVM Virtualization type: full L1d cache: 640 KiB (20 instances) L1i cache: 640 KiB (20 instances) L2 cache: 80 MiB (20 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-19 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Unknown: No mitigations Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; TSX disabled

PR fix notes

PR #36774: [Bugfix] fix Qwen3.5 tool calling bug

Description (problem / solution / changelog)

<!-- markdownlint-disable -->

Purpose

FIX https://github.com/vllm-project/vllm/issues/36769

Test Plan

Test Result


<details> <summary> Essential Elements of an Effective PR Description Checklist </summary>
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.
</details>

Changed files

  • vllm/tool_parsers/qwen3coder_tool_parser.py (modified, +7/-5)

Code Example

==============================
        System Info
==============================
OS                           : Ubuntu 24.04.3 LTS (x86_64)
GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version                : Could not collect
CMake version                : Could not collect
Libc version                 : glibc-2.39

==============================
       PyTorch Info
==============================
PyTorch version              : 2.9.1+git8907517
Is debug build               : False
CUDA used to build PyTorch   : N/A
ROCM used to build PyTorch   : 7.0.51831-a3e329ad8

==============================
      Python Environment
==============================
Python version               : 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] (64-bit runtime)
Python platform              : Linux-6.8.0-83-generic-x86_64-with-glibc2.39

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : Could not collect
CUDA_MODULE_LOADING set to   :
GPU models and configuration : AMD Instinct MI300X VF (gfx942:sramecc+:xnack-)
Nvidia driver version        : Could not collect
cuDNN version                : Could not collect
HIP runtime version          : 7.0.51831
MIOpen runtime version       : 3.5.0
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               20
On-line CPU(s) list:                  0-19
Vendor ID:                            GenuineIntel
BIOS Vendor ID:                       QEMU
Model name:                           INTEL(R) XEON(R) PLATINUM 8568Y+
BIOS Model name:                      pc-q35-6.1  CPU @ 2.0GHz
BIOS CPU family:                      1
CPU family:                           6
Model:                                207
Thread(s) per core:                   1
Core(s) per socket:                   20
Socket(s):                            1
Stepping:                             2
BogoMIPS:                             4600.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq dtes64 vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd arat vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk avx512_fp16 arch_capabilities
Virtualization:                       VT-x
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            640 KiB (20 instances)
L1i cache:                            640 KiB (20 instances)
L2 cache:                             80 MiB (20 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-19
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Unknown: No mitigations
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; TSX disabled

==============================
Versions of relevant libraries
==============================
[pip3] conch-triton-kernels==1.2.1
[pip3] numpy==2.1.3
[pip3] onnx==1.19.0
[pip3] onnx-ir==0.2.0
[pip3] onnxscript==0.6.2
[pip3] onnxslim==0.1.87
[pip3] pyzmq==27.1.0
[pip3] torch==2.9.1+git8907517
[pip3] torchaudio==2.9.0+eaa9e4e
[pip3] torchvision==0.24.1+d801a34
[pip3] transformers==4.57.6
[pip3] triton==3.4.0
[pip3] triton_kernels==1.0.0
[conda] Could not collect

==============================
         vLLM Info
==============================
ROCM Version                 : 7.0.51831-a3e329ad8
vLLM Version                 : 0.17.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
  ============================ ROCm System Management Interface ============================
================================ Weight between two GPUs =================================
       GPU0
GPU0   0

================================= Hops between two GPUs ==================================
       GPU0
GPU0   0

=============================== Link Type between two GPUs ===============================
       GPU0
GPU0   0

======================================= Numa Nodes =======================================
GPU[0]          : (Topology) Numa Node: 0
GPU[0]          : (Topology) Numa Affinity: 0
================================== End of ROCm SMI Log ===================================

==============================
     Environment Variables
==============================
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=

---

(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Error in extracting tool call from response.
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Traceback (most recent call last):
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]   File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 310, in extract_tool_calls
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]     self._parse_xml_function_call(function_call_str, request.tools)
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]   File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 246, in _parse_xml_function_call
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]     end_index = function_call_str.index(">")
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] ValueError: substring not found
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
==============================
        System Info
==============================
OS                           : Ubuntu 24.04.3 LTS (x86_64)
GCC version                  : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version                : Could not collect
CMake version                : Could not collect
Libc version                 : glibc-2.39

==============================
       PyTorch Info
==============================
PyTorch version              : 2.9.1+git8907517
Is debug build               : False
CUDA used to build PyTorch   : N/A
ROCM used to build PyTorch   : 7.0.51831-a3e329ad8

==============================
      Python Environment
==============================
Python version               : 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] (64-bit runtime)
Python platform              : Linux-6.8.0-83-generic-x86_64-with-glibc2.39

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : Could not collect
CUDA_MODULE_LOADING set to   :
GPU models and configuration : AMD Instinct MI300X VF (gfx942:sramecc+:xnack-)
Nvidia driver version        : Could not collect
cuDNN version                : Could not collect
HIP runtime version          : 7.0.51831
MIOpen runtime version       : 3.5.0
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               20
On-line CPU(s) list:                  0-19
Vendor ID:                            GenuineIntel
BIOS Vendor ID:                       QEMU
Model name:                           INTEL(R) XEON(R) PLATINUM 8568Y+
BIOS Model name:                      pc-q35-6.1  CPU @ 2.0GHz
BIOS CPU family:                      1
CPU family:                           6
Model:                                207
Thread(s) per core:                   1
Core(s) per socket:                   20
Socket(s):                            1
Stepping:                             2
BogoMIPS:                             4600.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq dtes64 vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd arat vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk avx512_fp16 arch_capabilities
Virtualization:                       VT-x
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            640 KiB (20 instances)
L1i cache:                            640 KiB (20 instances)
L2 cache:                             80 MiB (20 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-19
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Unknown: No mitigations
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; TSX disabled

==============================
Versions of relevant libraries
==============================
[pip3] conch-triton-kernels==1.2.1
[pip3] numpy==2.1.3
[pip3] onnx==1.19.0
[pip3] onnx-ir==0.2.0
[pip3] onnxscript==0.6.2
[pip3] onnxslim==0.1.87
[pip3] pyzmq==27.1.0
[pip3] torch==2.9.1+git8907517
[pip3] torchaudio==2.9.0+eaa9e4e
[pip3] torchvision==0.24.1+d801a34
[pip3] transformers==4.57.6
[pip3] triton==3.4.0
[pip3] triton_kernels==1.0.0
[conda] Could not collect

==============================
         vLLM Info
==============================
ROCM Version                 : 7.0.51831-a3e329ad8
vLLM Version                 : 0.17.0
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled
GPU Topology:
  ============================ ROCm System Management Interface ============================
================================ Weight between two GPUs =================================
       GPU0
GPU0   0

================================= Hops between two GPUs ==================================
       GPU0
GPU0   0

=============================== Link Type between two GPUs ===============================
       GPU0
GPU0   0

======================================= Numa Nodes =======================================
GPU[0]          : (Topology) Numa Node: 0
GPU[0]          : (Topology) Numa Affinity: 0
================================== End of ROCm SMI Log ===================================

==============================
     Environment Variables
==============================
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=
</details>

🐛 Describe the bug

I am currently using Qwen3.5 9b -> specifically this variant | https://huggingface.co/lovedheart/Qwen3.5-9B-FP8

I present a list of options in the prompt and ask the LLM to choose one of the options using a designated tool call The majority of prompts work just fine, but a portion of all my requests run into the error message shown below

(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Error in extracting tool call from response.
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] Traceback (most recent call last):
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]   File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 310, in extract_tool_calls
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]     self._parse_xml_function_call(function_call_str, request.tools)
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]   File "/root/.venv/lib/python3.12/site-packages/vllm/tool_parsers/qwen3coder_tool_parser.py", line 246, in _parse_xml_function_call
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]     end_index = function_call_str.index(">")
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338]                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=66306) ERROR 03-11 08:34:27 [qwen3coder_tool_parser.py:338] ValueError: substring not found

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

Fix Plan

The error occurs because the index() method in Python raises a ValueError when the specified value is not found in the string. To fix this issue, we need to add error handling to check if the substring exists before trying to find its index.

Here are the steps to fix the issue:

  • Open the qwen3coder_tool_parser.py file and navigate to the _parse_xml_function_call method.
  • Modify the line end_index = function_call_str.index(">") to handle the case when ">" is not found in the string.
  • Use the find() method instead of index(), which returns -1 if the substring is not found.

Example code:

def _parse_xml_function_call(self, function_call_str, request_tools):
    # ...
    end_index = function_call_str.find(">")
    if end_index == -1:
        # Handle the case when ">" is not found
        # For example, raise a custom error or return an error message
        raise ValueError("Invalid function call string")
    # ...

Alternatively, you can use a try-except block to catch the ValueError exception and handle it accordingly:

def _parse_xml_function_call(self, function_call_str, request_tools):
    # ...
    try:
        end_index = function_call_str.index(">")
    except ValueError:
        # Handle the case when ">" is not found
        # For example, raise a custom error or return an error message
        raise ValueError("Invalid function call string")
    # ...

Verification

To verify that the fix worked, test the _parse_xml_function_call method with different input strings, including cases where the ">" character is not present. Check that the method handles these cases correctly and raises the expected error or returns the expected result.

Extra Tips

  • Make sure to test the fix thoroughly to ensure it does not introduce any new issues.
  • Consider adding additional error handling to handle other potential edge cases.
  • If the issue persists, try debugging the code to identify the root cause of the problem.

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