anomalyco / anomalyco/opencode
Native write tool fails to create larger artifact files while Bash/Python writes succeed — OpenCode Desktop v1.18.21
@rekram1-node is already working on this.
Since Aug 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
I am reporting what appears to be a failure in OpenCode's native write tool when creating larger/generated artifact files.
Environment:
- OpenCode Desktop: v1.18.21
- Host OS: Ubuntu/Linux
- OpenCode process user: normal local user (
growstore) - Model during the observed incident: NVIDIA Nemotron 3 Ultra
- Target filesystem: normal local filesystem under a user-writable project/output directory
Summary:
During a governed artifact-generation task, the agent repeatedly attempted to create a relatively large structured output file using OpenCode's native write tool.
The agent would announce its intention to write the file, but the expected file would not materialize on disk.
This happened repeatedly.
The important part is that the failure did not appear to be caused by filesystem permissions, ownership, or a generally unwritable target directory.
I performed several checks:
- The OpenCode processes were running as the expected local user.
- The target output directories were writable by that user.
- A manual filesystem write as the same user succeeded.
- A Bash-based write initiated from the same OpenCode session succeeded.
- A local Python-based file write initiated from the same session succeeded.
- A small/tiny native
writetest also succeeded. - The larger native
writeoperation repeatedly failed to produce the expected file.
The same live OpenCode session was then instructed to stop using the native write tool and instead serialize/write the artifact using Bash plus local Python.
The artifact was immediately created successfully.
The session did not need to be restarted.
This strongly suggests that the underlying filesystem and process permissions were functional and that the failure was somewhere in the native OpenCode write path, tool invocation/generation path, or handling of larger write payloads.
Observed behavior:
Native write, small file:
PASS
Native write, larger structured artifact:
FAIL / file does not materialize
Bash write in same session:
PASS
Python write in same session:
PASS
Manual write as same OS user:
PASS
Expected behavior:
When the agent invokes the native write tool with valid content and a path inside a writable directory, the complete file should be created reliably.
If the write cannot be completed because of a payload/tool/runtime limit, OpenCode should return a clear tool error explaining why the operation failed.
Actual behavior:
The larger write did not produce the expected file.
From the user-facing agent interaction, the model repeatedly appeared to reach the point where it intended to perform the write, but no resulting file appeared.
There was no useful filesystem/permission error explaining the failure.
Repeated attempts resulted in repeated write intentions rather than a successful artifact or a clear failure condition.
The same content/workflow could be completed by switching the agent to Bash + Python file generation.
Reproduction outline:
- Start OpenCode Desktop v1.18.21 on Linux.
- Work inside a confirmed user-writable directory.
- Ask the agent to generate a reasonably large structured artifact, for example a substantial JSON or Markdown file.
- Require it to use the native
writetool. - Verify whether the expected file actually appears and contains the complete requested content.
- If the native write does not materialize, perform a small native-write probe.
- Then write an equivalent/larger file using Bash or local Python in the same OpenCode session.
- Compare the results.
In my case:
- tiny native write: successful
- larger native write: repeatedly unsuccessful
- Bash/Python workaround: immediately successful
This makes a general permissions problem unlikely.
Current workaround:
I have had to impose the following runtime rule for OpenCode tasks that generate governed artifacts:
"Do not use OpenCode's native write tool for artifact/file creation. Use Bash with local Python or equivalent shell processing, then validate/read back the resulting file."
That workaround is reliable, but it is not desirable as a permanent requirement because file creation is a core coding-agent capability.
Impact:
For coding and autonomous-agent workloads, unreliable native file creation is a serious issue.
It can result in:
- an agent believing an artifact is being created when it is not;
- repeated tool/intention loops;
- incomplete task execution;
- wasted context/tokens;
- misleading completion states;
- and the need for custom shell/Python workarounds for ordinary file output.
In governed workflows this is especially problematic because artifact existence, exact contents, checksums, and downstream validation may be part of the task contract.
I have therefore stopped treating the native write tool as reliable for our OpenCode workflows until this can be reproduced and corrected.
Possible areas to investigate:
- payload-size handling in the native
writetool; - truncation or serialization limits;
- tool-call generation for large arguments;
- desktop/runtime transport between the model tool call and filesystem operation;
- silent rejection of oversized write payloads;
- timeout behavior;
- whether the tool invocation is being emitted at all when larger content is involved;
- whether failures are being swallowed instead of surfaced to the model/user.
I am not asserting which layer is responsible.
The evidence currently only supports this narrower conclusion:
A larger native OpenCode write operation repeatedly failed to materialize a file in a directory that was demonstrably writable, while both Bash and local Python writes succeeded in the same live session and a tiny native-write probe also succeeded.
I can provide additional logs or run a controlled reproduction if the OpenCode maintainers want specific diagnostics collected.
Plugins
No response
OpenCode version
1.18.21
Steps to reproduce
auxmemory-phase-1g-benchmark-contract-review.json
Screenshot and/or share link
Operating System
Ubuntu 24.04.4 LTS
Terminal
GNOME Terminal v3.52.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.