Skip to content

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

Open

Description

@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:

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.

Activity

  1. added
    bug
    CLI
    sandbox
    on Mar 29, 2026
  2. github-actions commented on Mar 29, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. matttennie commented on Mar 29, 2026

    @matttennie
    Author

    Correction: the OS version is macOS 26.3.1(a) (Darwin 25.3.0 kernel), not Darwin 25.3.0 as originally stated.

  4. removed
    CLI
    on Mar 30, 2026
  5. added
    regression
    on Mar 30, 2026
  6. cdxiaodong commented on Apr 2, 2026

    @cdxiaodong

    sodo i

    Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugregressionsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions