Skip to content

Deleting and re-adding a project with a different path reuses stale worktree #35851

Closed

Description

@pipixiaa

Description

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.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jul 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    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.

  2. Hona commented on Sep 2, 2026

    @Hona
    Member

    Fixed for opencode2 launch via #46713
    You can try the desktop beta here: https://github.com/anomalyco/opencode-beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions