Skip to content

Tool calls emit raw XML tags as text; write() reports success but file is never created (v2.0.31, Windows 11) #56204

Closed as not planned

Description

@alesioandresv-ops

Describe the bug

Two related failures in the same long-running agent session (many tool calls):

1. Tool calls serialize incorrectly — raw XML tags leak as literal text

Model-emitted tool calls are not parsed cleanly. The raw parameter tags (the closing "parameter" and "invoke" tags) appear as literal text in the conversation output instead of being consumed as a tool call. Observed on read and shell calls. Sometimes the actual tool result is correct but wrapped in garbage; sometimes the output truncates mid-stream.

Ironically, this bug reproduced WHILE drafting this report: a write call containing the literal tag strings failed to parse as JSON and was never executed.

2. write reports success but the file is never created (critical)

A write call was issued to create backend/migrations/versions/0024_business_active_on_register.py. The tool returned:

{"path":"C:\\...\\0024_business_active_on_register.py","bytesWritten":122,"success":true}

Immediately afterward, Test-Path on that exact path returned False, and a directory listing of backend/migrations/versions/ ends at 0023_reconcile_schema.py. The file was never written to disk despite the success response.

To reproduce

  1. Run a long agent session with many tool calls (reads, shell, writes).
  2. Observe tool calls emitting raw closing parameter/invoke tags as text in the output.
  3. Issue a write tool call — it returns success:true with a plausible byte count.
  4. Verify the file exists (Test-Path / directory listing) — it does not.

Expected behavior

  • Tool calls serialize cleanly; no raw XML tags appear in the output.
  • A write that returns success:true means the file actually exists on disk.

Screenshots/logs

  • Symptom 1: the conversation fills with blocks of the closing parameter tag after tool calls.
  • Symptom 2: Test-Path returns False right after a write that reported success:true, bytesWritten:122.

Environment

  • OpenCode version: v2.0.31 (what opencode --version reports while running). Note: npm ls -g shows opencode-ai@1.18.33.
  • OS: Windows 11 Pro Education (10.0.26100)
  • Shell: PowerShell 5.1.26100.9711
  • Install method: npm global (C:\Users\Estudiante\AppData\Roaming\npm)
  • Node: v24.16.0

Additional context

  • Restarting the session did not fix it — the corruption recurred after restart.
  • Suspect the tool-call serialization path and/or the filesystem write not actually flushing to disk.
  • The write reported a plausible byte count (122 lines), suggesting the content was processed but never persisted.
  • Project context: a monorepo (FastAPI backend + React frontend). No antivirus observed interfering.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! Before we can try to reproduce this, we need a few more details:

    1. Provider and model in use when this happened (e.g. OpenCode Go / DeepSeek V4.1 Flash, Anthropic / Claude …). Raw tool-call tags appearing as text usually mean the model wrote its tool call as plain text instead of making a real tool call. In earlier reports this depended on the provider and model.
    2. Which OpenCode is actually running. opencode --version reports 2.0.31, but the only global npm package you listed is opencode-ai@1.18.33, which is OpenCode v1. Could you share the output of where opencode and npm ls -g @opencode/cli in PowerShell?
    3. Plugins or MCP servers you have configured, if any.
    4. A screenshot or exported session of the write step. In v2.0.31 the built-in write tool doesn't return {"path":…,"bytesWritten":…,"success":true}. It replies with Created file successfully: <path>. So that result most likely came from another tool (MCP/plugin), or the model wrote it out as text during the same tag leak, in which case no write actually ran. A screenshot or export showing whether a real write tool call appears there would settle it.

    You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

    Possibly related issues, ordered by likelihood:

  2. alesioandresv-ops commented on Oct 16, 2026

    @alesioandresv-ops
    Author
  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the quick answers, @alesioandresv-ops! That confirms the version (v2.0.31), the model (Big Pickle on the OpenCode provider) and context7 as the only MCP server.

    That helps narrow things down:

    To tell whether OpenCode is mishandling a real tool call or the model is writing fake ones, we need to see the session. Could you share one of these?

    1. An export of the affected session: in the TUI, open that session, run /export and attach the file here (remove anything private first). Or
    2. A screenshot of the part of the conversation where the write "succeeded". Please show whether it appears as a real write tool entry (a tool block with the file path and a diff) or just as plain text in the assistant's reply.

    It would also help to know whether the tags still appear if you switch to a different model in the same project.

  4. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Closing this for now, since we haven't received the session export or screenshot we asked for. Without it, we can't tell whether OpenCode mishandled a real write tool call or Big Pickle wrote the tool call and its "success" result as plain text. The {"path","bytesWritten","success"} response doesn't come from OpenCode 2.0.31's write tool or from context7, so the second explanation is the more likely one.

    If it happens again, please reopen this issue or open a new one and attach either the session export (/export in the TUI) or a screenshot that shows whether the write appeared as a real tool entry. It would also help to know whether it happens with other models. Meanwhile, #54599 is the related open issue about Big Pickle putting its internal markup into the reply text.

    Thanks for the report, @alesioandresv-ops!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions