Error opening file for writing
This issue might be a duplicate of existing issues. Please check:
- #4374: File system operations fail on windows with azure provider
- #729: Opencode in linux cannot access tools or create files
- #3902: File edits not applied - shows diff output only without modifying files
- #5362: Write Tool includes metadata in output and created filecontent
Feel free to ignore if none of these address your specific case.
This is an issue impacting upgrade of OpenCode Desktop on Windows.
All the upgrade flows will fail with: Error opening file for writing: with the AppData path for opencode-cli.exe. The impacted flows being: automated update directly on the app itself, or directly installing the new setup to upgrade, or re-installing)
The cause seems to be that those flows don't properly uninstall the existing instance before attempting to add the new one.
Workaround: Uninstall OpenCode using Control Panel and install the new version (download from https://opencode.ai/download) (should clear the previous binaries and allow them to be replaced)
Another option would be to kill the running opencode-cli.exe instance. You'll find the older version running on your Task Manager (but it's called "Bun", you can search for "opencode" in processes to get the correct one. Killing this, will unblock the update if you select Retry.
Actual fix may need a review of the upgrade flow to properly cleanup the existing resources.
Working through a bunch of windows things, we hope to get this to better state real soon for yall, thanks!