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
Deleting and re-adding a project with a different path reuses stale worktree #35851
Bug: Deleting and re-adding a project with a different path reuses stale worktree
Describe the bug When a project is removed from OpenCode desktop and re-added at a different filesystem path, the desktop app reuses the existing database record. It updates the sandboxes (additional directories) but does not update project.worktree, so the primary path remains the old one. This makes the project unusable — it still points to the deleted/moved location.
To Reproduce
Add a project at /old/path/my-project to OpenCode desktop
Remove that project from OpenCode
Move the project directory to /new/path/my-project
Add the project at /new/path/my-project
The desktop app still shows/uses /old/path/my-project as the primary path
Inspect ~/.local/share/opencode/opencode.db: project.worktree still has the old path
Expected behavior Removing a project and re-adding it should create a fresh record with the correct worktree, or the re-add should update the worktree to the new path.
Environment
OpenCode Desktop (latest)
macOS / Linux / Windows
Additional context Manually updating project.worktree and project_directory.directory in the SQLite database resolves the issue. The root cause is that project deletion doesn't fully clear the record, and re-add doesn't overwrite worktree.
Activity
github-actions commentedon Jul 8, 2026
This issue might be a duplicate of existing issues. Please check:
project.worktreeafter project folder is renamed on disk; remote clients keep reopening the dead path #35240: Server keeps staleproject.worktreeafter project folder is renamed — same root cause (DB record not updated, same SQLite workaround), and nearly identical symptoms.If your issue is distinct (e.g. specific to the desktop re-add flow rather than rename/move), please add that context so it can be triaged separately.
Hona commentedon Sep 2, 2026
Fixed for opencode2 launch via #46713
You can try the desktop beta here: https://github.com/anomalyco/opencode-beta