How to Band-aid Fix Codex “Undefined error: 0” on Git Push

Codex CLI 0.163.0 on macOS 27 may fail to push on the local network with ssh: connect to host … Undefined error: 0, even when the hosts are reachable. On the same machine, Claude Code succeeds in pushing.

The band-aid is one flag, --no-daemon, which runs Codex without its shared background server, even while one is already running. I start Codex through a shell function in ~/.zshrc, so the flag went there:

codex() {
    command codex --no-daemon "$@"
}

command makes the function call the Codex binary instead of itself. Since the flag comes first, codex resume and codex fork get it too, and both accept it there. Do be sure to reload ~/.zshrc, or a shell that’s already open keeps the old function.

If needed, you can bypass the --no-daemon flag by using command codex. The flag doesn’t affect the desktop app either. Skipping the daemon disables background server features: remote control, the codex agents dashboard, and work that keeps running after you close the window.

Another potential fix is to reboot the Mac. It works until macOS blocks the daemon from the LAN again.

The daemon in question is Codex’s app-server daemon. Since 0.157.0, an interactive codex starts it by default and runs its commands there instead of in its own process. The daemon outlives the Terminal that started it, and macOS’s Local Network privacy blocks it from the LAN at times. The unified log shows the failing ssh as unsatisfied (Local network prohibited). It also shows macOS failing to look up the Terminal that had started the daemon.

Codex couldn’t identify the problem and suggested a reboot, which worked only briefly. Claude narrowed it down through the unified log and Codex’s session history, and GitHub’s issue tracker dated the daemon default back to 0.157.0. My session history showed no use of those background server features.

This is a band-aid fix until OpenAI fixes the daemon’s LAN access, and the flag comes out when it does. With a block this intermittent, though, one successful push through the daemon won’t prove the problem is fixed.