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_

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 4 months ago

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

  • #17367

Powered by Codex Action

etraut-openai contributor · 4 months ago

Yeah, if you delete the binary, it won't work. I don't think this is a bug in Codex.

dcolascione · 4 months ago

You could snapshot the name at startup and keep using it

dcolascione · 4 months ago

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.