#Tool Calling is broken on Qwen-3-coder streaming

8 messages · Page 1 of 1 (latest)

manic rampartBOT
#

@tardy blaze

Description:

Bug Report: Qwen3-Coder Missing Function Names in Streaming Tool Calls

Date: 2026-01-12
Reporter: DevMate Investigation
Severity: Critical
Component: qwen/qwen3-coder via OpenRouter


Executive Summary

qwen/qwen3-coder via OpenRouter drops function names from tool_calls in streaming mode approximately 22% of the time. The model correctly signals intent to call a tool (finish_reason: "tool_calls") but the function.name field is null/empty, making the tool call unusable.

Non-streaming mode works 100% correctly.

Impact: Applications using streaming mode with Qwen3-Coder will experience ~22% tool call failure rate, causing agent workflows to break unpredictably.


Environment

Component Value
Model qwen/qwen3-coder
API OpenRouter (https://openrouter.ai/api/v1)
Test Date 2026-01-12
Client Direct HTTP (httpx)

Bug Description

When making streaming requests (`st

What I've Tried:

  1. Direct API Testing - Same battery of tests as GLM investigation

    • Streaming vs non-streaming comparison
    • Various prompt styles
    • Multiple iterations to establish failure rate
  2. Capture Raw Responses - Get full chunk data from failures

  3. Compare with GLM-4.7 - GLM worked fine, what's different?

Error Messages:

In streaming mode, the model emits:
- `finish_reason: "tool_calls"` ✓
- `tool_calls` array with valid ID ✓
- `function.arguments` with valid JSON ✓
- `function.name` is **null/empty** ✗

Example failed response:
```json
{
  "tool_calls": [{
    "id": "call_a9425bc04bee4dc1967c6fed",
    "type": "function",
    "function": {
      "name": null,  // <-- BUG: Missing function name!
      "arguments": "{}"
    }
  }]
}

**API/Model:** qwen/qwen-3-coder
#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help escalate and debug this issue, can you provide:

  1. The exact full error response (raw JSON chunk) you receive from the streaming API when the bug occurs?
  2. The specific model identifier you're using (is it qwen/qwen3-coder, qwen/qwen3-coder-flash, or another variant? Please copy the full model name from your API call.)
  3. The minimal code or HTTP request you are using to trigger the tool call in streaming mode?

These details will help determine if this is a model-specific streaming serialization bug or possibly an integration issue.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

tardy blaze
manic rampartBOT
#

I don't have the ability to view or extract information from zip files or attachments. Please paste the relevant details (such as your minimal code, prompt, and a sample failed raw JSON response) directly into this chat. This will help me and the mods debug your streaming tool call issue more effectively.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

tardy blaze
#

Example failed response:

{
  "tool_calls": [{
    "id": "call_a9425bc04bee4dc1967c6fed",
    "type": "function",
    "function": {
      "name": null,  // <-- BUG: Missing function name!
      "arguments": "{}"
    }
  }]
}
manic rampartBOT
#

Thank you for the detailed bug report and example response.

The OpenRouter documentation states:
"When providing multiple tools, you can inspect tool_call.function.name to figure out what function you need to call locally."
and
"The LLM responds with a finish reason of tool_calls, and a tool_calls array." Tool & Function Calling

Your example shows function.name is null in streaming mode, which is not expected and breaks tool routing logic. This is likely a model or integration bug specific to streaming for qwen/qwen3-coder, since non-streaming works as documented.

Recommended next steps:

  • Double-check that your streaming code is buffering all chunks and reconstructing the full tool call structure, as described in the docs:
    "When using streaming responses with tool calls, handle the different content types appropriately..." Tool & Function Calling
  • If your code matches the documented streaming handler and the issue persists, this is likely an upstream bug.

Since this is a platform or model-specific issue, please report it directly to the OpenRouter team or ask a mod in the Discord server for escalation. Include your raw streaming chunks, model identifier, and a summary of your findings.

If you have any billing or account issues, email [email protected]. For technical bugs like this, contacting the mods on Discord is recommended.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

tardy blaze
#

Ah, the classic automated support response that doesn't actually read the report 😅

Their "recommended next step" is literally what we already did and proved works correctly:

"Double-check that your streaming code is buffering all chunks and reconstructing the full tool call structure"

We did exactly that. The test scripts buffer all chunks, reconstruct the tool calls properly, and the function name simply isn't there in ~22% of cases. We even saved the raw chunks as evidence in streaming_validation_results.json.

The bot is basically saying "make sure you're doing it right" when we already proved:

  1. ✅ Our streaming reconstruction code works (78% of calls succeed)
  2. ✅ Non-streaming with identical code = 100% success
  3. ✅ The raw chunks themselves are missing the function name

Next Step: Discord Escalation

Since the bot confirmed this needs human eyes:

"For technical bugs like this, contacting the mods on Discord is recommended."

Would you like me to draft a concise Discord message for you? Something like:


Bug: qwen/qwen3-coder streaming drops function names ~22% of time

Non-streaming: 100% valid tool calls (45/45)
Streaming: 77.8% valid (35/45) - function.name is null

Raw chunks saved, reproduction script included. Automated support suggested escalation.

Full report: [link to zip or gist]


Want me to prepare that, or do you want to just paste the bug report link directly?

manic rampartBOT
#

I don't have specific documentation for this exact issue. Please verify with the mods or check the OpenRouter docs directly for the most accurate information.

For technical bugs like this, the best next step is to contact mods through the Discord server and provide your report, reproduction steps, and raw streaming evidence. This aligns with the official guidance:
"You can file bug reports or change requests by posting in our Discord."
OpenRouter FAQ

Let me know if you want a concise Discord escalation message drafted, or if you’d prefer to share your bug report and reproduction link directly.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.