What this thread does
As of November 2026, split large writes and inspect the resulting file. Do first: interrupt the stalled write and request smaller chunks; a 2.2.2 user report also describes silent truncation after a success result.
The problem
OpenCode shows "Preparing write..." and then hangs or prints "Tool execution aborted", mostly when the model writes a large new file such as a plan or spec. The GitHub issue (opened 2026-01-29 by yinzhou-jc) was closed as a duplicate on 2026-10-01. Commenters saw it with GitHub Copilot models, Anthropic models via several providers, DeepSeek and Kimi; some said Gemini and GLM worked.
What a member said
On 2026-10-01 an OpenCode member closed it as a duplicate of #18108, saying a stuck "Preparing write..." usually means the tool call was cut off at the model's output token limit and OpenCode neither reports that clearly nor recovers. The author of #18108 (a user's analysis, not an official statement) adds that the default output cap is 32,000 tokens and that thinking tokens share the budget, so large files can be truncated even when they look small. On 2026-10-11 a maintainer closed #18108 as not planned in a sweep of every issue filed against OpenCode 1, asking people to reopen or file again if it still happens on 2.0. One commenter on #11112 reported the same symptom on OpenCode v2.0.19 on 2026-09-29. A later report in #18108 on 2026-10-30 describes a different failure on 2.2.2: a large write reported success but left a truncated file; an edit also reportedly left its file unchanged. This is a user report, not a maintainer diagnosis of the 2.2.2 behavior.
One commenter suggested it may sometimes be slow rather than frozen: with a captured session they said waiting long enough let the write finish, and several asked for a progress or token counter. That is an opinion, not a maintainer finding.
What commenters report helping
- Ask for smaller writes: tell the session, or put it in
AGENTS.md, to write big documents in batches or to split the file. Commenters reported this working with Opus and Sonnet 4.6, but it is a mitigation, one said not 100%. - Raise the output limit: The V1 CLI reference lists the environment variable
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX("Max output tokens for LLM responses"), and the model docs showlimit.outputin model config. The environment variable is documented for V1; neither doc says this fixes the hang; it is a lever consistent with the member's explanation. Do not set it above what your model supports. - Switch model or tool: a commenter found that after interrupting and asking the model to use
editinstead ofwrite, it worked. - Reported, riskier: one commenter set
editto deny and bash to allow in the permission config so the model writes through shell commands. That removes the edit approval path, so only consider it if you accept the bash risk; see the thread on OpenCode permissions.
Caveats
#18108 was filed against OpenCode 1.x and closed in the 2.0 sweep, while #11112 was closed as a duplicate on 2026-10-01 and has a later report from v2.0.19, so closure alone does not establish a fix. The October 30 report adds a reason to inspect the saved file even after a tool reports success; its author recommends smaller edits, chunked assembly and reading the file back.
Sources
- OpenCode #11112: duplicate closure and output-limit explanation.
- OpenCode #18108: 1.x analysis, 2.0 closure and October 30 report on 2.2.2.
- CLI reference and model limits: configuration controls, without a promise to resolve the hang.
- OpenCode CLI guide.
Started from a post by @yinzhou-jc, packaged by the editor. Original post