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 }}
This repository was archived by the owner on Aug 11, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 11, 2026. It is now read-only.
Sidebar "+" button fails to launch new session — opencode not found due to stripped PATH #26
Clicking the "+" icon in the sidebar to add a new session fails immediately with:
bash: line 0: exec: opencode: not found
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Ghostty failed to launch the requested command:
/usr/bin/login -flp mmorek /bin/bash --noprofile --norc -c exec -l opencode
Runtime: 47 ms
Press any key to close the window.
opencode is installed and works correctly when launched from any other terminal (Ghostty, iTerm2, Terminal.app, etc.).
Root cause
Ghostty's macOS login shell mechanism uses /bin/bash as a throwaway intermediary to exec into the target command. Critically, it passes --noprofile and --norc, which means bash starts with only the bare system PATH (typically /usr/bin:/bin:/usr/sbin:/sbin). Any PATH additions made in ~/.zshrc, ~/.zprofile, ~/.bash_profile, etc. are never sourced.
opencode's default install locations — ~/.opencode/bin, $HOME/bin, $HOME/.local/bin, or npm/bun global bin dirs — are none of them on the bare system PATH. So while opencode resolves fine in an interactive shell, it is invisible to the stripped environment Ghostree uses to launch the sidebar session.
This is not a user configuration problem. The same Ghostty-level mechanism works correctly for regular terminal windows because those launch the user's actual shell (zsh), which sources the appropriate profile files and has the full PATH. The sidebar bypasses this entirely by passing opencode as a bare command name into a profileless bash.
Steps to reproduce
Install opencode via the install script or npm (default install path: ~/.opencode/bin or similar user-local directory)
Verify opencode works: open any terminal and run opencode — it launches correctly
Open Ghostree, click the "+" button in the sidebar
Observe the error above
Expected behavior
A new opencode session launches in the context of the current worktree.
Actual behavior
The session window opens and immediately closes with opencode: not found.
Suggested fix
Ghostree should resolve the opencode binary path at launch time using the user's full login shell environment, then pass the absolute path to Ghostty's command config rather than the bare name opencode.
Alternatively, Ghostree could check common install locations (~/.opencode/bin, ~/.local/bin, $HOME/bin, npm/bun global prefix) at startup and warn if opencode cannot be found in any of them, rather than silently failing at session launch time.
Workaround
Symlink or copy opencode to a system PATH location:
changed the title [-]Unable to create a new worktree session from sidebar[/-][+]Sidebar "+" button fails to launch new session — `opencode` not found due to stripped PATH[/+]on Mar 4, 2026
Activity
[-]Unable to create a new worktree session from sidebar[/-][+]Sidebar "+" button fails to launch new session — `opencode` not found due to stripped PATH[/+]nicosuave commentedon Mar 4, 2026
Thanks for the report @matthewmorek
nicosuave commentedon Mar 5, 2026
Fixed by #28
New release is going up shortly