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
The Write tool (packages/core/src/tool/write.ts) has no guard against writing empty or whitespace-only content. If the model generates an empty string as content, the tool will overwrite the existing file with nothing. The data is permanently lost with no undo.
The tool's Input schema defines content as Schema.String with no minimum length validation. An empty string "" is accepted and written.
Empty writes should be treated as destructive when the target exists. Before Write commits, compare target existence, previous size/hash, new byte length, and whether the model explicitly intended truncation.
If content is empty or whitespace-only and the old file was non-empty, require an explicit truncate flag or user confirmation. The tool result should include previous size/hash and new size, so accidental zero-byte overwrites are detectable and recoverable from editor/VCS history when available.
I can confirm this is still happening as of August 2026. The write tool emptied my orbitian-studios.html file (712 lines → 0 bytes) while editing other HTML files in the same project. No git history was available for recovery. Running OpenCode Desktop on macOS Apple Silicon M4.
Activity
Necmttn commentedon Jun 21, 2026
Empty writes should be treated as destructive when the target exists. Before Write commits, compare target existence, previous size/hash, new byte length, and whether the model explicitly intended truncation.
If content is empty or whitespace-only and the old file was non-empty, require an explicit truncate flag or user confirmation. The tool result should include previous size/hash and new size, so accidental zero-byte overwrites are detectable and recoverable from editor/VCS history when available.
Generated with ax.
rekram1-node commentedon Jun 22, 2026
STOP SPAMMING ISSUES.
yeffmartinezmusic-source commentedon Aug 26, 2026
I can confirm this is still happening as of August 2026. The write tool emptied my orbitian-studios.html file (712 lines → 0 bytes) while editing other HTML files in the same project. No git history was available for recovery. Running OpenCode Desktop on macOS Apple Silicon M4.