anomalyco / anomalyco/opencode
Bug: AI emptied html to 0 bytes during file edit
@rekram1-node is already working on this.
Since Aug 26, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
What happened
The opencode AI agent deleted the entire contents of orbitian-studios.html while performing edits on other HTML files in the same directory. The file went from approximately 712 lines of production HTML/CSS/JS code to 0 bytes (completely empty).
I did not request this file to be edited. The agent appears to have accidentally wiped it while working on other files in the project.
Expected behavior
- The agent should only edit files the user explicitly asks to modify
- A file should never go from N bytes to 0 bytes without explicit user confirmation
- There should be a safeguard against writing empty content to a file
What I lost
- A full page (~712 lines) of HTML/CSS/JS for a music production studio website (Orbitian Studios)
- Days of work on this specific file
- No git history was initialized in the project, so local recovery was not possible
Steps to reproduce
- Have a project folder with multiple .html files (index.html, servicios.html, orbitian-studios.html, etc.)
- Ask opencode to edit one or more files in the project
- opencode modifies files but also empties
orbitian-studios.htmlentirely without being asked
Environment
- OS: macOS Sequoia, Apple Silicon M4, 16GB RAM
- Project: static HTML/CSS/JS website (no frameworks)
- Model used: [add the model name from your session here]
Suggestion
Add a safety check: before writing to any file, verify the new content is not empty. If the content is empty, abort the write operation and warn the user. This would prevent accidental data loss.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
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.