Codex Desktop fails creating worktree for branch
Open 💬 2 comments Opened Jun 29, 2026 by JKamsker
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.623.42026 • Released 27.06.2026
What subscription do you have?
PRO
What platform is your computer?
Linux 7.0.0-15-generic x86_64 unknown | Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
[info] Starting worktree creation
fatal: invalid reference: codex/add-datetime-rpc-support
[stderr] git worktree add failed: fatal: invalid reference: codex/add-datetime-rpc-support
What steps can reproduce the bug?
- Have a repo on github
- On remote server, only main is checked out
- In codex app: Create new worktree from branch which exists on github
What is the expected behavior?
Worktree is being created successfully
Additional information
_No response_
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional data point: this also reproduces when the selected branch exists only as a remote-tracking ref.
Example shape:
origin/feature/foofeature/foofatal: invalid reference: feature/fooLocal validation:
git worktree add --detach <path> feature/foofails withfatal: invalid referencewhen onlyorigin/feature/fooexists.git worktree add --detach <path> origin/feature/fooworks.worktree.guessRemote=trueandcheckout.defaultRemote=origindo not fix the detached case.Suggested behavior: when creating a detached Codex-managed worktree, if
<branch>is not a valid local ref butorigin/<branch>exists, Codex should useorigin/<branch>as the commit-ish, or create the local tracking branch automatically before callinggit worktree add.