Agent unable to save due to malformed write payload #8673

Open
opened 2026-02-16 18:10:33 -05:00 by yindo · 4 comments
Owner

Originally created by @amatecha on GitHub (Feb 5, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Started a new project and have been trying to formulate a proper Plan (as people always suggest). I first made a PLAN.md from another agent. That is the only file in the project, other than .opencode having been created by opencode.

Upon attempting to save the plan (to .opencode/plan/****.md) it fails every time. Somehow the payload to the write tool is always malformed.

  • It seems to try to indicate the filePath twice, and the second instance is escaped improperly. <- causing the JSON parse error
  • The path it was intending to write to is incorrect. My working directory for the project is /home/amatecha/git/myproject (and that is where I launched opencode from), but the logged filePath is /home/amatecha/.opencode/plans/gateway-development-plan.md for some reason. It should have been /home/amatecha/git/myproject/.opencode/plans/gateway-development-plan.md

Example:

  ⚙ invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text:{"content":"exampletext","filePath":"/home/amatecha/.opencode/plans/gateway-development-plan.md","filePath"/home/amatecha/.opencode/plans/gateway-development-plan.md"}.
Error message: JSON Parse error: Unrecognized token '/']

(note I replaced the plan text with "exampletext" above. The length of the string previously there was 16663 bytes, if that's relevant)

Installed opencode via shell script install method. I have the following feature flag in my .bashrc:

export OPENCODE_EXPERIMENTAL_PLAN_MODE=1

I'm using qwen3-coder-next via llama.cpp if that's relevant.

Plugins

none that I know of

OpenCode version

1.1.53 (happened in 1.1.51 as well)

Steps to reproduce

1.have Experimental Plan mode enabled
2. create a new dir
3. cd into dir
4. run opencode
5. go to Plan mode and come up with a quick plan
6. tell the agent to save the plan and confirm whatever filename it suggests
7. note the failure to save due to above-described error

Screenshot and/or share link

No response

Operating System

Linux Mint 22

Terminal

xfce4-terminal

Originally created by @amatecha on GitHub (Feb 5, 2026). Originally assigned to: @thdxr on GitHub. ### Description Started a new project and have been trying to formulate a proper Plan (as people always suggest). I first made a `PLAN.md` from another agent. That is the only file in the project, other than `.opencode` having been created by opencode. Upon attempting to save the plan (to `.opencode/plan/****.md`) it fails every time. Somehow the payload to the `write` tool is always malformed. * It seems to try to indicate the `filePath` twice, and the second instance is escaped improperly. <- causing the JSON parse error * The path it was intending to write to is incorrect. My working directory for the project is `/home/amatecha/git/myproject` (and that is where I launched `opencode` from), but the logged `filePath` is `/home/amatecha/.opencode/plans/gateway-development-plan.md` for some reason. It should have been `/home/amatecha/git/myproject/.opencode/plans/gateway-development-plan.md` Example: ``` ⚙ invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text:{"content":"exampletext","filePath":"/home/amatecha/.opencode/plans/gateway-development-plan.md","filePath"/home/amatecha/.opencode/plans/gateway-development-plan.md"}. Error message: JSON Parse error: Unrecognized token '/'] ``` (note I replaced the plan text with "exampletext" above. The length of the string previously there was 16663 bytes, if that's relevant) Installed opencode via shell script install method. I have the following feature flag in my `.bashrc`: ``` export OPENCODE_EXPERIMENTAL_PLAN_MODE=1 ``` I'm using `qwen3-coder-next` via `llama.cpp` if that's relevant. ### Plugins none that I know of ### OpenCode version 1.1.53 (happened in 1.1.51 as well) ### Steps to reproduce 1.have Experimental Plan mode enabled 2. create a new dir 3. cd into dir 4. run `opencode` 5. go to Plan mode and come up with a quick plan 6. tell the agent to save the plan and confirm whatever filename it suggests 7. note the failure to save due to above-described error ### Screenshot and/or share link _No response_ ### Operating System Linux Mint 22 ### Terminal xfce4-terminal
yindo added the bug label 2026-02-16 18:10:33 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10883: unable to write plan to .opencode/plans in plan mode - directly addresses plan mode write failures
  • #11630: Write tool JSON parsing error with large files and special characters - reports JSON parsing errors with large content (your payload was 16663 bytes)
  • #5890: Incomplete JSON when writing out files - reports similar JSON parsing errors where the closing brace is missing

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #10883: unable to write plan to .opencode/plans in plan mode - directly addresses plan mode write failures - #11630: Write tool JSON parsing error with large files and special characters - reports JSON parsing errors with large content (your payload was 16663 bytes) - #5890: Incomplete JSON when writing out files - reports similar JSON parsing errors where the closing brace is missing Feel free to ignore if none of these address your specific case.
Author
Owner

@amatecha commented on GitHub (Feb 6, 2026):

Issue also being reported on the model page at https://huggingface.co/unsloth/Qwen3-Coder-Next-GGUF/discussions/5 and https://huggingface.co/unsloth/Qwen3-Coder-Next-GGUF/discussions/2 , may be something wrong with the model itself? Even on the original Qwen model, https://huggingface.co/Qwen/Qwen3-Coder-Next/discussions/14 /shrug

@amatecha commented on GitHub (Feb 6, 2026): Issue also being reported on the model page at https://huggingface.co/unsloth/Qwen3-Coder-Next-GGUF/discussions/5 and https://huggingface.co/unsloth/Qwen3-Coder-Next-GGUF/discussions/2 , may be something wrong with the model itself? Even on the original Qwen model, https://huggingface.co/Qwen/Qwen3-Coder-Next/discussions/14 /shrug
Author
Owner
@crashr commented on GitHub (Feb 6, 2026): https://github.com/ggml-org/llama.cpp/issues/19382#issuecomment-3857279673
Author
Owner

@crashr commented on GitHub (Feb 6, 2026):

I got it working with this reverse proxy which I wrote some time ago to connect a streaming client to llama-server when it wasn't able to stream when tool calling was used.
https://github.com/crashr/llama-stream

@crashr commented on GitHub (Feb 6, 2026): I got it working with this reverse proxy which I wrote some time ago to connect a streaming client to llama-server when it wasn't able to stream when tool calling was used. https://github.com/crashr/llama-stream
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8673