Repository navigation
Description
Description
Bug Description
OpenCode IDE on Windows creates corrupted directory structure that persists across reinstalls and portable installations:
- Junction loops:
%USERPROFILE%,%APPDATA%,%LOCALAPPDATA%directories created inside OpenCode installation folder - Windows reserved names:
nulfile keeps reappearing after deletion - Permission corruption:
takeown/icaclscommands fail repeatedly due to process locks - Corruption copies to portable installations during setup from backup
… - C:\Tools\OpenCode (Portable Mode - also corrupted)
Expected Behavior
Clean directory structure without:
Junction loops to system directories
Windows reserved names (nul, con, prn, aux, etc.)
Permission corruption preventing cleanup
Actual Behavior
Corrupted directory with:
C:\Users\Admin\AppData\Local\OpenCode
├── %USERPROFILE%/ ← Junction loop
├── %APPDATA%/ ← Junction loop
├── %LOCALAPPDATA%/ ← Junction loop
├── nul ← Windows reserved name
├── test.txt ← Corruption artifact
├── OpenCode.exe ← Main executable
└── opencode-cli.exe ← CLI tool
❌ Cannot uninstall cleanly
❌ Requires manual cleanup with PowerShell robocopy methods
❌ Corruption returns after reinstall
❌ Blocks Windows users from using OpenCode IDE
❌ Portable Mode workaround also affected (corruption copies from backup)
❌ Development work blocked until fixed
Workaround Attempted
Portable Mode Installation
Install to C:\Tools\OpenCode (outside AppData)
Use --user-data-dir=C:\Tools\OpenCode\Data
Result: Corruption copied from backup during installation
Cleanup Commands (Temporary Fix)
Kill processes
Get-Process | Where-Object {$_.Name -like "open"} | Stop-Process -Force
Remove junctions first
Remove-Item "OpenCode%USERPROFILE%" -Force -Recurse
Remove-Item "OpenCode%APPDATA%" -Force -Recurse
Remove-Item "OpenCode%LOCALAPPDATA%" -Force -Recurse
Then remove main directory
Remove-Item "C:\Users\Admin\AppData\Local\OpenCode" -Force -Recurse
Clear registry
Remove-Item "HKCU:\Software\OpenCode" -Recurse -Force
Note: Corruption returns after next OpenCode launch.
Request
✅ Avoid creating junction loops to system directories
✅ Release stable Windows build with proper path handling
✅ Provide official portable installation option
✅ Add corruption prevention checks on startup
Additional Context
Multiple recovery attempts
macOS/Linux builds appear stable (based on GitHub releases)
Windows build appears to be beta/unstable
Issue affects both AppData and Portable Mode installations
Specific to Windows 10 (Version 10.0.19045.6466)
System Information
Platform: win32
Architecture: x64
OS: Windows 10 (Version 10.0.19045.6466)
Node Version: v22.12.0
npm Version: 10.9.0
OpenCode Version: 1.2.27
Installation Type: Both AppData and Portable tried
Plugins
None
OpenCode version
1.2.27
Steps to reproduce
Steps to Reproduce
- Install OpenCode on Windows
-
- Run OpenCode IDE with any project
- Check installation directory for corrupted files:
Get-ChildItem "C:\Users\Admin\AppData\Local\OpenCode" -Force
- Observe:
Directories named %USERPROFILE%/, %APPDATA%/, %LOCALAPPDATA%/
File named nul (Windows reserved name)
File named test.txt (corruption artifact) - Attempt to delete - fails with "directory busy" or permission errors
- Reinstall - corruption returns
- Portable Mode - corruption copies during installation from backup
Screenshot and/or share link
Operating System
Windows 10 (Version 10.0.19045.6466)
Terminal
Windows Terminal cmd powershell bash
Activity
github-actions commentedon Mar 20, 2026
This issue might be a duplicate of existing issues. Please check:
nulfile #13369: Undeletablenulfile — covers the same Windows reserved namenulfile that keeps reappearingnulbeing created in the working directorynulfile generation issue on WindowsThe junction loop portion (
%USERPROFILE%,%APPDATA%,%LOCALAPPDATA%directories being created inside the installation folder) may be unique to this report. If thenulfile aspect is already covered by the above, please consider whether this issue should focus specifically on the junction loop behavior.leonardleong commentedon Mar 20, 2026
Additional Context: Junction Loop Behavior
Thank you for identifying the related
nulfile issues. I want to highlight that my report includes an additional corruption pattern that may be unique:Junction Loop Directories Created Inside OpenCode Installation
C:\Users\Admin\AppData\Local\OpenCode
├── %USERPROFILE%/ ← Junction/symlink loop
├── %APPDATA%/ ← Junction/symlink loop
│ └── OpenCode/ ← Nested loop!
├── %LOCALAPPDATA%/ ← Junction/symlink loop
│ └── OpenCode/ ← Nested loop!
├── nul ← Windows reserved name (matches #13369)
└── test.txt ← Unknown artifact
Why This Matters
nulfile issues - Related issues (Undeletablenulfile #13369, Unexpected file named "nul" is repeatedly created after updating OpenCode #11403, nul file generate #11586) focus onnulfile onlyRequest
…- npm: 10.9.0
leonardleong commentedon Mar 20, 2026
Additional Context: Junction Loop Behavior (Potentially Unique)
Thank you for identifying the related nul file issues (#13369, #11403, #11586). I want to highlight that my report includes an additional corruption pattern that may be unique to my installation or affect a subset of Windows users.
🔍 Junction Loop Directories Created Inside OpenCode Installation
After multiple recovery attempts and Portable Mode installation, I observed the following directory structure being created at runtime inside the OpenCode installation folder:
C:\Users\Admin\AppData\Local\OpenCode
├── %USERPROFILE%/ ← Junction/symlink loop
│ └── Admin/
│ └── AppData/
│ └── Local/
│ └── OpenCode/ ← INFINITE LOOP!
├── %APPDATA%/ ← Junction/symlink loop
│ └── Roaming/
│ └── OpenCode/ ← Nested loop!
├── %LOCALAPPDATA%/ ← Junction/symlink loop
│ └── Local/
│ └── OpenCode/ ← Nested loop!
├── nul ← Windows reserved name (matches #13369)
├── test.txt ← Unknown artifact
├── OpenCode.exe ← Main executable
└── opencode-cli.exe ← CLI tool
🛠️ Technical Evidence
Verification Commands:
Check for junction loops
Get-ChildItem "C:\Users\Admin\AppData\Local\OpenCode" -Filter "%" -Force |
Select-Object Name, Mode, Target
Check reparse point attributes
fsutil reparsepoint query "C:\Users\Admin\AppData\Local\OpenCode%USERPROFILE%"
Check directory attributes
(Get-Item "C:\Users\Admin\AppData\Local\OpenCode%USERPROFILE%").Attributes
Attempt deletion (fails with "directory busy")
Remove-Item "C:\Users\Admin\AppData\Local\OpenCode%USERPROFILE%" -Force -Recurse
https://gyazo.com/b3a488d23b3986f9bb0472cba75073ed
https://gyazo.com/c840081a158ee96574a11a224764ba71
🔬 Root Cause Hypothesis
Windows expands these at filesystem level instead of application level
Junction points are created pointing back to parent directories
Self-referential loops form when OpenCode is installed in AppData
Corruption persists because junctions survive process termination
📝 Reproduction Steps (Specific to Junction Loops)
1. Install OpenCode to AppData
Default installation via OpenCode-Setup-latest.exe
2. Run OpenCode IDE
Open any project (e.g., C:\Users\Admin\openclaw)
3. Use OpenCode for normal development
Edit files, use AI features, etc.
4. Close OpenCode
Exit application normally
5. Check installation directory
Get-ChildItem "C:\Users\Admin\AppData\Local\OpenCode" -Force
6. Observe junction loops
%USERPROFILE%/, %APPDATA%/, %LOCALAPPDATA%/ directories present
7. Attempt cleanup
Standard deletion fails, requires robocopy method
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.