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

Resolved 💬 3 comments Opened Aug 13, 2025 by techjoec Closed Aug 13, 2025

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_

View original on GitHub ↗

3 Comments

techjoec · 1 year ago

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

techjoec · 1 year ago

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

kvcop · 10 months ago

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.