You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tool/edit: stale-content error mentions "permission approval" though any concurrent write triggers it #48707
edit reports File changed after permission approval. Read it again before editing. whenever FileMutation.StaleContentError fires, but that error is raised whenever the file's bytes differ from what the tool read — for example when another session or process writes the file during the edit's read→write window. The message misattributes the cause to the permission flow, which is confusing when debugging concurrent edits.
Environment
opencode version: 2.0.2
OS: Windows 11 (10.0.26220.9343, win32 x64)
Terminal: Unavailable: reproduced against the background service
Shell: cmd.exe
Install/channel: latest (2.0.2)
Active plugins: 4 local entries auto-discovered from ~/.config/opencode/plugins/
Reproduction
Start an edit on a file whose content another writer changes concurrently (same path, any session or process).
The store's compare-and-swap detects the mismatch and edit fails with: File changed after permission approval. Read it again before editing.
No permission approval was involved in the failing mutation.
Expected Behavior
A message that names the actual condition, e.g. File changed since it was read. Read it again before editing.
Actual Behavior
File changed after permission approval. Read it again before editing.
Additional Context
Source: packages/core/src/tool/edit.ts maps FileMutation.StaleContentError to this message; packages/core/src/file-mutation.ts raises it when the expected bytes differ from the current bytes under the per-path lock.
Impact is low — the message still tells the reader to re-read — but the stated reason is misleading in the common concurrent-write case.
packages/core/src/tool/edit.ts is the only place that maps it, and it's the mapping that introduces the permission wording — the error itself carries just a path.
So the message names a cause the error has no knowledge of. Any writer touching the file inside the read→write window produces it, permission flow or not.
I'll switch it to the wording you suggested, File changed since it was read. Read it again before editing., which describes the actual condition and keeps the same remedy. packages/core/test/tool-edit.test.ts pins the current string, so that assertion gets updated in the same PR — which also keeps the change provably scoped to this one message.
I couldn't find the message File changed after permission approval. Read it again before editing. or FileMutation.StaleContentError in v2.0.2 or in the current dev branch. In those versions the edit tool is packages/core/src/tool/plugin/edit.ts, and file-mutation.ts no longer has that stale-content check (writes to the same path are serialized by a lock instead). The code you mention was in older source that has since been replaced, which may also be why #48904 was closed.
Could you share:
The exact output of opencode --version from the install where you saw this error.
The actual tool output or log lines showing the message, if you saw it in a real session rather than in the source.
If you can still get this message on a current v2 release (latest is v2.2.0), please include the output. 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.
Related items, ordered by how closely they relate:
Closing this as not planned since we haven't heard back. We were waiting for the exact opencode --version and the actual tool output showing File changed after permission approval. Read it again before editing. That message and FileMutation.StaleContentError are in older source but not in v2.0.2 or the current dev branch, so there was nothing we could reproduce on the version you reported.
If you still see this message on a current v2 release, please open a new issue with the version and the output, and link back to #48707. Thanks for taking the time to report it!
Activity
rareboe commentedon Sep 14, 2026
Taking this one.
Confirmed both ends in the source:
packages/core/src/file-mutation.tsraisesStaleContentErrorfromwriteIfUnchanged, purely on a byte comparison under the per-path lock:packages/core/src/tool/edit.tsis the only place that maps it, and it's the mapping that introduces the permission wording — the error itself carries just apath.So the message names a cause the error has no knowledge of. Any writer touching the file inside the read→write window produces it, permission flow or not.
I'll switch it to the wording you suggested,
File changed since it was read. Read it again before editing., which describes the actual condition and keeps the same remedy.packages/core/test/tool-edit.test.tspins the current string, so that assertion gets updated in the same PR — which also keeps the change provably scoped to this one message.PR shortly.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report!
I couldn't find the message
File changed after permission approval. Read it again before editing.orFileMutation.StaleContentErrorin v2.0.2 or in the currentdevbranch. In those versions the edit tool ispackages/core/src/tool/plugin/edit.ts, andfile-mutation.tsno longer has that stale-content check (writes to the same path are serialized by a lock instead). The code you mention was in older source that has since been replaced, which may also be why #48904 was closed.Could you share:
opencode --versionfrom the install where you saw this error.If you can still get this message on a current v2 release (latest is v2.2.0), please include the output. 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.
Related items, ordered by how closely they relate:
opencodejr commentedon Oct 31, 2026
Closing this as not planned since we haven't heard back. We were waiting for the exact
opencode --versionand the actual tool output showingFile changed after permission approval. Read it again before editing.That message andFileMutation.StaleContentErrorare in older source but not in v2.0.2 or the currentdevbranch, so there was nothing we could reproduce on the version you reported.If you still see this message on a current v2 release, please open a new issue with the version and the output, and link back to #48707. Thanks for taking the time to report it!