anomalyco / anomalyco/opencode

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

Open
#38,842 1 comment 4 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Jul 25, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.