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
Workspace working directory not updated after moving project to new location #30005
When a project is moved from its original location to a new path (e.g., an external drive), closing the old workspace in opencode GUI and re-adding it at the new path does not update the working directory. The environment still uses the original workspace path, which no longer exists.
Steps to Reproduce
Open a project at location A
Move/copy the project to location B
In opencode GUI, close the workspace and add location B
Start a session
Try to use any file system tool
Expected Behavior
The working directory should reflect the current workspace path (location B).
Actual Behavior
The environment still uses the original path (location A), causing file system tools to fail with NotFound: FileSystem.access errors.
Environment
macOS
opencode GUI
Notes
The workspace path is stored in the GUI's data file, but even after updating it, the working directory is fixed at process launch time.
changed the title [-]GUI sets wrong working directory when project is on external drive[/-][+]Workspace working directory not updated after moving project to new location[/+]on May 30, 2026
I can reproduce this on Linux with the web UI/server using opencode v1.15.13.
After moving a project to a new base directory and reopening it from the new location, opencode still used stale path data from ~/.local/share/opencode/opencode.db:
project.worktree still pointed to the old missing path
one session.directory also pointed to the old missing path
project.sandboxes already contained the new path
So opencode seems to partially detect the new location, but the UI/tool environment still relies on stale project/session paths. I saw the same pattern with another moved project too.
Manually editing SQLite is not user-friendly. It would be helpful if the UI detected missing project paths and offered a safe "Relink" / "Refresh missing project" action that preserves sessions and updates path pointers like project.worktree and session.directory.
+1 — same root cause on Windows 11 + WSL2, Desktop v1.17.9. Renamed project folder, workspace working directory never updated. Desktop keeps falling back to the old path despite all cache clearing attempts. See my detailed comment on #30697 for the full list of workarounds tried.
Same issue here.. Windows 11. Not sure if reinstalling OpenCode would solve the issue, but it's kind of a hassle to set everything back up. Is there a file or a location where a project can be deleted so we can open it from scratch?
Update: I went nuclear on the cache. (WARNING) This deleted all my project's data but I didn't mind. Closed the project in OpenCode app and closed the app itself, deleted opencode file in project .git directory, deleted opencode dirs in [user]/.cache and [user]/.local. Started OpenCode app and added the project from scratch.
Confirmed on macOS with OpenCode Desktop 1.18.9 after renaming a Git repository and using Close
project → Add project with the new path.
Old path:
/Users/xx/Sites/projects/content
New path:
/Users/xx/Sites/projects/blog
OpenCode retained the session history, but new sessions would not launch.
A read-only inspection of ~/.local/share/opencode/opencode.db showed:
project.worktree still referenced the deleted old path
project_directory.directory contained the correct new path
project.sandboxes contained the new path
both paths were associated with the same project ID
PRAGMA integrity_check returned ok
The logs showed repeated failures resolving the deleted path:
PlatformError: NotFound: FileSystem.realPath (...), caused by ENOENT.
This matches the root cause described in #39056: Project.fromDirectory() retains existing.worktree
even when that path no longer exists, while the new path is added as a sandbox. Desktop navigation then
resolves the sandbox back to the stale primary worktree.
I’m experiencing what appears to be the same underlying issue, but on Windows and with a directory rename rather than moving the project to a different location.
Reproduction:
Add D:\Projects\my-project as a workspace in OpenCode.
Rename the directory externally using Windows File Explorer: my-project → my-project-renamed
The existing workspace becomes unusable.
Remove the old workspace from OpenCode.
Add D:\Projects\my-project-renamed as a new workspace.
The newly added workspace is still unusable.
Rename the directory back to my-project.
The workspace immediately works again.
So even after removing the old workspace and adding the new path, OpenCode appears to retain or resolve some state against the original path/name.
This seems closely related to this issue, although in my case the path only changes because the directory is renamed, not moved to another location.
Activity
github-actions commentedon May 30, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct (specifically around macOS external drives mounted at
/Volumes/), it would be helpful to cross-reference these issues.[-]GUI sets wrong working directory when project is on external drive[/-][+]Workspace working directory not updated after moving project to new location[/+]lgcenen commentedon May 30, 2026
Fixed in #30007
nitipit commentedon Jun 1, 2026
I can reproduce this on Linux with the web UI/server using opencode v1.15.13.
After moving a project to a new base directory and reopening it from the new location, opencode still used stale path data from
~/.local/share/opencode/opencode.db:project.worktreestill pointed to the old missing pathsession.directoryalso pointed to the old missing pathproject.sandboxesalready contained the new pathSo opencode seems to partially detect the new location, but the UI/tool environment still relies on stale project/session paths. I saw the same pattern with another moved project too.
Manually editing SQLite is not user-friendly. It would be helpful if the UI detected missing project paths and offered a safe "Relink" / "Refresh missing project" action that preserves sessions and updates path pointers like
project.worktreeandsession.directory.Related: #27822 and #23248.
wesoho commentedon Jun 6, 2026
我遇到了同样的问题
WhiteGiverMa commentedon Jun 21, 2026
+1 — same root cause on Windows 11 + WSL2, Desktop v1.17.9. Renamed project folder, workspace working directory never updated. Desktop keeps falling back to the old path despite all cache clearing attempts. See my detailed comment on #30697 for the full list of workarounds tried.
andjelicsasa commentedon Jun 26, 2026
Same issue here.. Windows 11. Not sure if reinstalling OpenCode would solve the issue, but it's kind of a hassle to set everything back up. Is there a file or a location where a project can be deleted so we can open it from scratch?
Update: I went nuclear on the cache. (WARNING) This deleted all my project's data but I didn't mind. Closed the project in OpenCode app and closed the app itself, deleted opencode file in project .git directory, deleted opencode dirs in [user]/.cache and [user]/.local. Started OpenCode app and added the project from scratch.
Stf-F commentedon Jul 30, 2026
Confirmed on macOS with OpenCode Desktop 1.18.9 after renaming a Git repository and using Close
project → Add project with the new path.
Old path:
/Users/xx/Sites/projects/contentNew path:
/Users/xx/Sites/projects/blogOpenCode retained the session history, but new sessions would not launch.
A read-only inspection of
~/.local/share/opencode/opencode.dbshowed:project.worktreestill referenced the deleted old pathproject_directory.directorycontained the correct new pathproject.sandboxescontained the new pathPRAGMA integrity_checkreturnedokThe logs showed repeated failures resolving the deleted path:
PlatformError: NotFound: FileSystem.realPath (...), caused byENOENT.This matches the root cause described in #39056:
Project.fromDirectory()retainsexisting.worktreeeven when that path no longer exists, while the new path is added as a sandbox. Desktop navigation then
resolves the sandbox back to the stale primary worktree.
This is still reproducible in 1.18.9.
TheSummer001 commentedon Aug 31, 2026
I’m experiencing what appears to be the same underlying issue, but on Windows and with a directory rename rather than moving the project to a different location.
Reproduction:
D:\Projects\my-projectas a workspace in OpenCode.my-project→my-project-renamedD:\Projects\my-project-renamedas a new workspace.my-project.So even after removing the old workspace and adding the new path, OpenCode appears to retain or resolve some state against the original path/name.
This seems closely related to this issue, although in my case the path only changes because the directory is renamed, not moved to another location.
Environment:
Hona commentedon Sep 2, 2026
Fixed for opencode2 launch via #46713
You can try the desktop beta here: https://github.com/anomalyco/opencode-beta