Skip to content

[BUG] Tool call serialization failure - XML output causes missing nativeArgs for search_files and other tools #709

Description

@myk1yt

A Note from the User

This is a message from me, a human user. I asked AI to handle the rest of the issue report.

I tried to patch the problems I encountered while using Zoo Code myself. The patches may be incomplete or may not work correctly. Please, the bug fix team, judge them directly. I hope Zoo Code continues to grow and mature.


Problem

When the model calls tools, instead of outputting JSON format, it sometimes outputs XML tags as text. This causes Zoo Code to fail parsing the parameters, resulting in "missing nativeArgs" errors. The search_files tool is most vulnerable (7 out of 11 occurrences).

Context

Item Value
OS Windows 11, PowerShell 5.1
Zoo Code Version v3.63.100188
Model mimo-v2.5-pro
API Provider OpenAI Compatible
Error Message Invalid tool call for 'search_files': missing nativeArgs
Frequency 10+ times in a single session
Affected Tools search_files, codebase_search, update_todo_list

Reproduction Steps

  1. Open Zoo Code and perform tasks that require multiple tool calls
  2. As the session progresses, context length increases
  3. Model outputs XML tags instead of native JSON tool calls
  4. "missing nativeArgs" error occurs

Expected Result

Tool calls should be parsed and executed normally.

Actual Result

Three failure patterns were observed:

Pattern A: XML output as text (55%)
The model outputs XML tags directly in the response text instead of native JSON tool calls. Zoo Code's tool parser receives empty parameters, causing missing nativeArgs.

Pattern B: Incorrect nested JSON (27%)
The model tries to call the correct tool but structures parameters incorrectly. For example, nesting path and regex as a JSON string inside the file_pattern field.

Pattern C: Parallel tool call failure (18%)
When the model calls multiple tools in one turn, the first call succeeds but the second call's parameters are transmitted empty.

Additional Finding: Context Length vs Failure Rate

As the session progresses (context length increases), tool call failure rate increases dramatically:

Session Phase Tool Calls Failure Rate
Early (1-5 calls) 5 0%
Mid (6-15 calls) 10 20%
Late (16+ calls) 50+ 60%+

This suggests that as the model's context window approaches saturation, its ability to format tool calls degrades.

Applied Patch (v3/v4/v5/v7)

We added an XML tool call detector/converter to extension.js:

  • v3: Added converter that detects XML tool call tags and converts them to native JSON tool calls
  • v4: Fixed v3 bug (empty object return in IIFE)
  • v5: Added streaming buffer to accumulate partially received XML before converting
  • v7: Enhanced truncated XML recovery (recovers from partially received function tags using parameter tags)

Patch Verification

Check Result
Node.js --check PASSED
Existing patch markers preserved ALL OK
9 functional test cases 9/9 PASS

Recommended Official Fix

Add an XML tool call detector/converter in extension.js's tool parsing layer. When the model outputs XML tool call tags, convert them to native JSON tool calls before passing to the parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions