[GH-ISSUE #12751] [qwen3-coder] Improper parsing/signalling of tool calls with multiple tools #8455

Open
opened 2026-04-12 21:08:31 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @du291 on GitHub (Oct 23, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12751

Originally assigned to: @drifkin on GitHub.

What is the issue?


Request:
{
    'model': 'qwen3-coder',
    'messages': [
        {'role': 'system', 'content': 'You are a helpful assistant that can list files and get file contents. You can use the tools list_files and get_file_contents to get file contents.'},
        {'role': 'user', 'content': 'Explore the contents of each file in the current directory.'}
    ],
    'think': False,
    'tools': [
        {'type': 'function', 'function': {'name': 'list_files', 'description': 'List all files in the current working directory.', 'parameters': {}}},
        {
            'type': 'function',
            'function': {
                'name': 'get_file_contents',
                'description': 'Read the contents of a specified file.',
                'parameters': {'type': 'object', 'properties': {'file_name': {'type': 'string', 'description': 'The name of the file to read.'}}, 'required': ['file_name']}
            }
        }
    ],
    'stream': False
}
Response:
{
    'model': 'qwen3-coder',
    'created_at': '2025-10-23T08:34:11.354992959Z',
    'message': {
        'role': 'assistant',
        'content': "I'll help you explore the contents of each file in the current directory. First, I'll list all the files to see what we're working with, and then I'll examine each file's 
contents.\n\n<function=list_files>\n</function>\n</tool_call>"
    },
    'done': True,
    'done_reason': 'stop',
    'total_duration': 3402408903,
    'load_duration': 65879777,
    'prompt_eval_count': 348,
    'prompt_eval_duration': 1810528586,
    'eval_count': 51,
    'eval_duration': 1510323454
}

Note that qwen3-coder's tool call response is mangled in the content, missing the opening tag <tool_call> ; I checked OLLAMA_DEBUG=2 and that is exactly what the model outputs. When I keep only the list_files function, the model will use it properly, when i keep only the other one, it's hit and miss.

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @du291 on GitHub (Oct 23, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12751 Originally assigned to: @drifkin on GitHub. ### What is the issue? ``` Request: { 'model': 'qwen3-coder', 'messages': [ {'role': 'system', 'content': 'You are a helpful assistant that can list files and get file contents. You can use the tools list_files and get_file_contents to get file contents.'}, {'role': 'user', 'content': 'Explore the contents of each file in the current directory.'} ], 'think': False, 'tools': [ {'type': 'function', 'function': {'name': 'list_files', 'description': 'List all files in the current working directory.', 'parameters': {}}}, { 'type': 'function', 'function': { 'name': 'get_file_contents', 'description': 'Read the contents of a specified file.', 'parameters': {'type': 'object', 'properties': {'file_name': {'type': 'string', 'description': 'The name of the file to read.'}}, 'required': ['file_name']} } } ], 'stream': False } Response: { 'model': 'qwen3-coder', 'created_at': '2025-10-23T08:34:11.354992959Z', 'message': { 'role': 'assistant', 'content': "I'll help you explore the contents of each file in the current directory. First, I'll list all the files to see what we're working with, and then I'll examine each file's contents.\n\n<function=list_files>\n</function>\n</tool_call>" }, 'done': True, 'done_reason': 'stop', 'total_duration': 3402408903, 'load_duration': 65879777, 'prompt_eval_count': 348, 'prompt_eval_duration': 1810528586, 'eval_count': 51, 'eval_duration': 1510323454 } ``` Note that qwen3-coder's tool call response is mangled in the content, missing the opening tag \<tool_call> ; I checked OLLAMA_DEBUG=2 and that is exactly what the model outputs. When I keep only the `list_files` function, the model will use it properly, when i keep only the other one, it's hit and miss. ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 21:08:31 -05:00
Author
Owner

@masterkeysrd commented on GitHub (Feb 17, 2026):

I'm having the same issue with qwen3-coder, too.

Image
<!-- gh-comment-id:3911228775 --> @masterkeysrd commented on GitHub (Feb 17, 2026): I'm having the same issue with qwen3-coder, too. <img width="831" height="151" alt="Image" src="https://github.com/user-attachments/assets/e574e086-0ba6-45bc-b36c-a207b5477a0a" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#8455