Skip to content

Codex CLI becomes unusable if the working directory from which it was launched is moved or removed #2252

Closed as not planned

Description

@techjoec

What version of Codex is running?

0.21.0

Which model were you using?

n/a

What platform is your computer?

Windows 11 w/wsl2 running Ubuntu

What steps can reproduce the bug?

If you run codex from WSL in a directory such as C:\FOO\BAR\ and while inside the Codex CLI session C:\FOO\BAR\ is moved to C:\FOO\BLAH\ all future executions fail with "No such file or directory (os error 2)". Codex CLI seemed unable to cwd or execute other tricks to recover, and has to terminate to be usable again.

What is the expected behavior?

Either refuse to delete/move/etc the CWD from codex's launch, or ideally just handle it gracefully somehow. Sorry, not sure on a specific fix approach, but it definitely confused me for far too long tonight.

What do you see instead?

No such file or directory (os error 2)

Additional information

No response

Activity

  1. changed the title [-]Codex CLI becomes unusable if the working directory it was launched from is moved or removed[/-] [+]Codex CLI becomes unusable if the working directory from which it was launched is moved or removed[/+] on Aug 13, 2025
  2. added
    enhancementNew feature or request
    windows-osIssues related to Codex on Windows systems
    and removed
    bugSomething isn't working
    on Aug 13, 2025
  3. techjoec commented on Aug 13, 2025

    @techjoec
    Author

    Actually - might be something else. I will update but relaunch only worked for a very short period.

  4. techjoec commented on Aug 13, 2025

    @techjoec
    Author

    Yeah I dont know what the heck blew up. I did some reinstalls of codex and other frantic packages and it seems ok..

  5. kvcop commented on Oct 3, 2025

    @kvcop

    For me it's randomly having a crashout now and then. Sometimes relaunch help, other times it persists. It narrows down to it trying to launch python3 and getting os error 2 "file does not exist". It got so confused it tried to check python's version, which worked, and then tried to print something in console with smth like python3 -c "print(1);print(2)", which resulted in os error, which confused the model even further. Heck it confused me too. I suspect there's something about container or whatnot, i didn't check codex's source code, but it seems that inner container is not working properly maybe. I'm on WSL2 btw. Maybe it cd'd to some temp directory, it got deleted and python tries to set up its workdir to deleted directory, which results in this? Model for sure did some cd's, but didn't see any rm or mkdir, and task was about reading the files and describing them.

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

    enhancementNew feature or requestwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions