Skip to content

Desktop: Cannot open git worktree folders via "Open Project" — only the main worktree opens #38842

Closed as not planned

Description

@yuyuelong-mechmind

Description

Summary

In the OpenCode desktop app, File → Open Project silently fails (no error, no new tab, no loading state) when selecting a directory that is a git worktree of an already-open repository. Only the main worktree can be opened; all linked worktrees are ignored.

This makes it impossible to use OpenCode Desktop for the common workflow of keeping multiple branches checked out as linked worktrees side by side.

Reproduction

  1. Create a repo with linked worktrees (single repo, multiple working trees):
$ git worktree list
D:/projects/master/Mech_Eye_uhq                  a695d7510b [yuyl_uhq_rebase]
D:/projects/master/Mech_Eye_2d_exposure_event    541acf7b58 [yuyl/2d-exposure-event]
D:/projects/master/Mech_Eye_multi_roi            a103461a4f [yuyl/multi-roi]
D:/projects/master/Mech_Eye_product_form_switch  b3c17a563e [yuyl/product-form-switch]

Note that every linked worktree's .git is a file pointing to the main repo's common dir:

$ cat D:/projects/master/Mech_Eye_product_form_switch/.git
gitdir: D:/projects/master/Mech_Eye_uhq/.git/worktrees/Mech_Eye_product_form_switch
  1. Open the desktop app and open the main worktree Mech_Eye_uhq via File → Open Project → works fine.
  2. Now File → Open Project again and select a linked worktree, e.g. Mech_Eye_product_form_switch.
  3. Nothing happens: no new tab, no error toast, no loading indicator. The UI is completely unresponsive to the action.

Expected behavior

Each worktree is a distinct working directory with its own files and checked-out branch. Selecting it via Open Project should open it as a separate project/tab, just like any other folder.

Actual behavior

Only the main worktree opens. Every linked worktree of the same repo is silently ignored when Open Project is clicked.

Workaround

Launching a server manually inside the worktree and connecting to it from the desktop app works:

cd D:\projects\master\Mech_Eye_product_form_switch
opencode serve --port 4097

Then connect to http://localhost:4097 from the desktop app. This confirms the directory itself is fine — the bug is specifically in the Open Project flow.

Likely root cause

The desktop app appears to identify projects by the resolved git common directory rather than by the working-directory path. Because all linked worktrees share the same common dir (<main>/.git), opening a second worktree is treated as "this project is already open" and silently deduplicated.

For worktrees, project identity should be based on the working tree path (the directory the user selected), not the shared .git common dir.

Environment

  • OpenCode Desktop: v1.15.10 (also worth confirming against latest v1.18.5)
  • OS: Windows 11 Home (10.0.26200)
  • Git: repo with 4 linked worktrees under a common parent folder

Additional context

An unrelated, independent folder (a separate git repo at D:\projects\agent_suite) opens correctly every time, which rules out generic causes like path encoding, permissions, or file count (the failing worktree has ~6k files / ~700 MB, while a working repo here has ~12k files / ~9 GB).

Plugins

No response

OpenCode version

1.15.10

Steps to reproduce

  1. Have a git repo with linked worktrees. In my case git worktree list shows 4 entries sharing one common dir:
    D:/projects/master/Mech_Eye_uhq [main worktree]
    D:/projects/master/Mech_Eye_2d_exposure_event [linked worktree]
    D:/projects/master/Mech_Eye_multi_roi [linked worktree]
    D:/projects/master/Mech_Eye_product_form_switch [linked worktree]

  2. In OpenCode Desktop: File → Open Project → select the MAIN worktree (Mech_Eye_uhq).
    => Opens fine.

  3. File → Open Project again → select any LINKED worktree (e.g. Mech_Eye_product_form_switch).

  4. Nothing happens: no new tab, no error, no loading state. The action is silently ignored.

Note: an unrelated standalone git repo (D:\projects\agent_suite) opens fine in the same app session, so it's specific to linked worktrees.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

windows desktop

Activity

  1. github-actions commented on Jul 25, 2026

    @github-actions
    Contributor

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

  2. github-actions commented on Sep 24, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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