[Bug]: Native DashScope intermittent 400 missing name on RC4; null-name tool-call handling and 2.0.3 upgrade coverage
Describe the bug
We intermittently encounter the following DashScope error during a document-review workflow using ReAct agents and worker subagents on AgentScope Java 2.0.0-RC4:
Error in execution: DashScope API error: <400>
InternalError.Algo.InvalidParameter:
The provided messages input is invalid.
The error info is ['dict object' has no attribute 'name'].
The error is logged by io.agentscope.core.tool.subagent.SubAgentTool. This identifies where the failure surfaces, not necessarily where the invalid message originates.
This appears related to #1568, which reports the exact same error and includes a trace containing ToolUseBlock entries with name=null. We are opening this follow-up to clarify the native DashScope path and whether upgrading from RC4 to 2.0.3 addresses it.
To reproduce / observed setup
- A parent
ReActAgentdelegates document ranges to workerReActAgentinstances registered usingtoolkit.registration().subAgent(..., SubAgentConfig.builder().forwardEvents(false).build()).apply(). - Workers have document-reading/search tools and perform multiple model/tool rounds.
- The provider is native
DashScopeChatModel. - We have observed this symptom with Qwen3.5 Flash and still see it after switching to Qwen3.7 Flash. The apparent reduction in frequency is anecdotal; we do not have a controlled comparison.
- The failure is intermittent. We do not yet have a deterministic minimal reproduction or the raw SSE/request payload for the failing call. In particular, we have not yet confirmed a null-name block in our own failing trace or the effective streaming setting of that specific call.
Source inspection: possible failure path, not a confirmed root cause
Comparing the published RC4 and 2.0.3 tags:
DashScopeResponseParsercreates aToolUseBlockwith a placeholder name for argument-only chunks; if their ID is absent, it generates afragment_...ID.ToolCallsAccumulator.determineKey()prioritizes a non-empty ID before its placeholder/last-key fallback.ToolCallBuilder.merge()ignores placeholder names, so a builder created solely for such fragments can retain a null name.buildAllToolCalls()builds every accumulated builder without filtering null-name calls in both tags.
This suggests that a fragment with a distinct generated ID could remain separate from the named call and become a nameless tool call. Please confirm whether this path is reachable with native DashScope responses and whether another layer already reconciles it.
Relevant 2.0.3 sources:
Related PR #2205 proposes protocol-index-based accumulation and dropping nameless calls, but at the time of checking it is not merged. Its parser index propagation targets OpenAI; native DashScope coverage is not clear to us.
Expected behavior
- Correctly associate argument fragments with their named tool call, including late names and interleaved calls.
- Avoid persisting/sending invalid nameless tool calls back to DashScope.
- If the provider truly omits a required name, expose a clear diagnostic and bounded recovery/failure rather than silently losing a required tool operation.
- Preserve tool-call/tool-result pairing when handling malformed calls.
Environment
- AgentScope Java: 2.0.0-RC4 (currently running)
- Upgrade under consideration: 2.0.3; this particular failure has not been reproduced or regression-tested on 2.0.3
- Java: project targets Java 21; exact production runtime build not collected
- OS: production OS details not collected
- Provider: native DashScope (
DashScopeChatModel) - Current model reported by the application owner:
qwen3.7-flash; exact failed-request payload not captured
Questions / requested guidance
- Is this the same underlying problem as #1568, and is there a released fix covering native DashScope?
- Should upgrading RC4 to 2.0.3 improve this exact failure, or is a separate parser/accumulator fix required?
- Should native DashScope propagate a stable tool-call index rather than generate a new ID for argument-only fragments?
- #1568 suggests filtering null-name
ToolUseBlocks before reasoning. What is the supported hook/middleware approach in 2.0.x, including handling any associated tool results and retrying the omitted operation safely?
All logs above are sanitized. We can provide a minimal sanitized trace once the next failing call is captured.
Thanks for the source inspection - points 1-4 describe the mechanism correctly, and I can confirm this path is reachable. The accumulator does try to reconcile fragments, but a distinct generated id is the one id shape it cannot reconcile.
determineKey keys a block by its id whenever that id is non-empty (step 1), and only falls back to the last named tool call for a placeholder-named block that has no id (step 3). So a fragment merges into its parent in exactly two cases: it repeats the parent's id, or it has no id at all. fragment_<millis>_<index> is neither, so step 3 is never reached, every fragment opens its own builder, merge() ignores __fragment__ so that builder keeps name == null, and buildAllToolCalls() emits it unfiltered. One split tool call becomes one named block plus one nameless block per fragment.
The OpenAI and Anthropic parsers avoid this by marking fragments with an empty id, which is what lets step 3 fire:
// OpenAIResponseParser
ToolUseBlock.builder().id("")
// AnthropicResponseParser
ToolUseBlock.builder().id("") // Empty ID indicates fragment
There is a second symptom on the streaming path: ReasoningContext.enrichToolUseBlockWithId returns a block unchanged when it already has a non-empty id, and only stamps the real tool call id onto a fragment whose id is empty. Consumers were therefore handed the invented id and could not concatenate the chunks.
To your question 3 - the generated id is the problem, not the mechanism. #3474 makes the DashScope parser emit an empty id for an argument fragment that has no provider id, matching the other two formatters. Two tests fail on current main and pass after the change, e.g. Fragment must merge into its parent tool call ==> expected: <1> but was: <2>.
On question 1, I checked the tags: the same line is present in RC4 (then at agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/DashScopeResponseParser.java) and in 2.0.3, so I did not find a released fix. I cannot speak to #2205's native DashScope coverage.
One caveat: this pins down one deterministic way for the framework to produce a nameless tool call, which does not by itself rule out other sources for an intermittent failure on RC4. A sanitized failing payload would still be what closes this out.
Status update: #3474 (merged) stopped inventing tool call ids for DashScope argument fragments — a likely root cause of the intermittent 400s reported here. Keeping open until the null-name tool-call handling / 2.0.3 upgrade coverage side is confirmed.