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
opencode fails when opencode/ subdirectory is missing from repo #2591
Summary:
opencode fails to run in directories that don't contain an opencode/ subdirectory, with a misleading error message that doesn't explain the actual requirement.
Steps to Reproduce:
Navigate to any directory without an opencode/ subdirectory
Ensure opencode is properly authenticated (opencode auth login)
Run opencode
Expected Behavior:
opencode should either create the required opencode/ directory automatically, OR
Provide a clear error message explaining that an opencode/ directory is required and how to resolve it
Actual Behavior:
Error: Failed to change directory to /path/to/current/directory/opencode
Environment:
Directory tested: /opt/personal-repos/dev-stack and ~/personal-repos/dev-stack (symlink)
Authentication: Successfully completed with Claude
OS: cachyOS (arch based linux)
opencode version: 0.7.9
Workaround:
mkdir opencode
opencode # now works
Additional Notes:
The error message is misleading - initially appeared to be a symlink resolution issue
No documentation found explaining the opencode/ directory requirement
Error occurs regardless of symlinks (tested in both symlinked and direct paths)
Installation method: AUR via yay
Package version: 0.7.9-1
This issue might be a duplicate of existing issues. Please check:
Can't init my project #2269: Similar "Failed to change directory" error when trying to initialize projects, though that was with the opencode init command specifically
Feel free to ignore if none of these address your specific case.
You are correct that worked. I rm -rf'd the opencode dir and then tried opencode no period and it failed same message and then tried with the period opencode . and it worked fine in the symlinked directory.
Activity
github-actions commentedon Sep 14, 2025
This issue might be a duplicate of existing issues. Please check:
opencode initcommand specificallyFeel free to ignore if none of these address your specific case.
rekram1-node commentedon Sep 14, 2025
I think this is some bun bug I have seen this before...
Does it work without creating dir if you do:
brianluby commentedon Sep 14, 2025
You are correct that worked. I rm -rf'd the opencode dir and then tried opencode no period and it failed same message and then tried with the period opencode . and it worked fine in the symlinked directory.
brianluby commentedon Sep 14, 2025
But in both cases running /init came back with directory errors. Albeit the second time a lot less.
Read .github/copilot-instructions.md
Error: ENOENT: no such file or directory, scandir '/opt/personal-repos/dev-stack/.github'
The previous run without teh period have 5-10 of the /opt/ errors and I was in the symlink ~/personal-repos/dev-stack/
Not sure how exactly bun is being uses but this is deeper than just the initial setup.
thdxr commentedon Sep 14, 2025
what OS + version is this?
rekram1-node commentedon Sep 14, 2025
In the op it says:
OS: cachyOS (arch based linux)
opencode version: 0.7.9
nicoburniske commentedon Sep 14, 2025
also happens on nixos + opencode 0.8.0
doing
opencode .works howeverndrwstn commentedon Sep 15, 2025
Also on macOS 15.6.1; I've been doing
to have my window appropriately labeled.
rekram1-node commentedon Nov 20, 2025
I think this was fixed, lmk if u still have this issue