CLI panics on launch from git worktree directory: /tmp is absolute: NotFound

Open 💬 3 comments Opened Mar 29, 2026 by matttennie

What version of Codex CLI is running?

0.117.0

What subscription do you have?

Pro

Which model were you using?

N/A — crash occurs before model selection

What platform is your computer?

macOS Darwin 25.3.0

What terminal emulator and version are you using (if applicable)?

N/A (reproducible in any terminal)

What issue are you seeing?

codex panics immediately when launched from inside a git worktree directory. The crash happens at startup before any user interaction.

› The application panicked (crashed).
Message:  /tmp is absolute: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Location: protocol/src/protocol.rs:1036

What steps can reproduce the bug?

# 1. Create a worktree from any git repo
cd /path/to/any-repo
git worktree add /tmp/test-worktree some-branch --detach

# 2. Enter the worktree
cd /tmp/test-worktree

# 3. Launch codex
codex
# → immediate panic with the error above

What is the expected behavior?

Codex should launch normally inside a git worktree, the same way it launches inside a regular git checkout.

Additional information

Root cause hypothesis: Based on the analysis in #14146, AbsolutePathBuf::from_absolute_path() calls std::env::current_dir() internally (via absolutize()), even for already-absolute paths like /tmp. In a git worktree, the .git file is a pointer (gitdir: /path/to/main-repo/.git/worktrees/...) rather than a directory. The sandbox setup code at protocol/src/protocol.rs:1036 likely resolves the git root to a path that doesn't exist or can't be resolved in the worktree context, causing current_dir() or a subsequent path resolution to fail, which then makes the expect("/tmp is absolute") call panic.

Related issues:

  • #14146 — Same panic message, but triggered mid-session by a stale cwd (directory moved while Codex was running). Different trigger, same crash site.
  • #10297 — Same panic site but PermissionDenied variant instead of NotFound.

Key difference from #14146: This is a startup crash with a trivial reproduction path (just cd into any worktree and run codex). No mid-session directory manipulation is needed. Any user who uses git worktree for development cannot use Codex CLI at all in those directories.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗