Self-exec via /proc/self/exe breaks when executable deleted
Resolved 💬 4 comments Opened Apr 23, 2026 by dcolascione Closed Apr 23, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
Main
What subscription do you have?
Yes
Which model were you using?
_No response_
What platform is your computer?
Linux
What terminal emulator and version are you using (if applicable)?
_No response_
What issue are you seeing?
Codex tries to exec itself for various purposes by running the executable to which /proc/self/exe points, but when the executable is deleted (e.g. by cargo while hacking on Codex itself), the /proc/self/exe symlink points to the original path plus " (deleted)", which is unlikely to name a working codex binary.
What steps can reproduce the bug?
Delete the running codex binary, perhaps by doing a cargo build of Codex.
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Yeah, if you delete the binary, it won't work. I don't think this is a bug in Codex.
You could snapshot the name at startup and keep using it
The scenario here isn't deleting the binary exactly, but using codex to develop codex and things in an existing session going wrong as cargo overwrites the launched binary.