codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex CLI gets stuck with no welcome message and broken keyboard shortcuts

Open andhikadk opened this issue 4 months ago • 4 comments

What version of Codex is running?

codex-cli 0.30.0

Which model were you using?

gpt-5

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

  1. Run codex from terminal.
  2. Normally, a welcome message appears, but in this case nothing shows up.
  3. The CLI appears stuck in this state.
  4. Keyboard shortcuts stop working properly (e.g., Backspace inserts a space, exit shortcuts don’t work).

What is the expected behavior?

  • Codex CLI should show the standard welcome message after running codex.
  • Keyboard shortcuts (Backspace, Ctrl+C, etc.) should function normally.
  • The user should be able to exit the session cleanly.

What do you see instead?

  • No welcome message.
  • CLI stuck in an unresponsive mode.
  • Backspace becomes Space.
  • Exit shortcuts don’t work, so I can’t quit normally.
Image

Instead of responding to arrow keys, the CLI outputs raw escape sequences: Image

Additional information

Issue happens randomly, not always. Restarting the terminal doesn’t fix it. Reinstalling Codex CLI also doesn’t solve the problem. I also experienced this bug in a previous version of Codex CLI.

andhikadk avatar Sep 07 '25 17:09 andhikadk

Is there a clean repro way? this will help a lot.

aibrahim-oai avatar Sep 07 '25 23:09 aibrahim-oai

I had a similar issue! The problem was permission-related - Codex couldn't create session files due to directory ownership issues.

Quick fix to try: sudo chown -R $USER:$USER ~/.codex/sessions/

What to check:

  • Look at ~/.codex/log/codex-tui.log for "Permission denied" errors
  • Check if ~/.codex/sessions/ directories have correct ownership

This happens when session directories get created with root permissions, preventing Codex from writing rollout files. The ownership fix usually resolves the stuck startup and keyboard issues.

abushadab avatar Sep 08 '25 01:09 abushadab

Is there a clean repro way? this will help a lot.

I don’t have a clean reproducible way yet — the issue happens randomly. Sometimes codex starts normally, other times it gets stuck (screenshot above). Restarting the terminal doesn’t help, reinstalling CLI also doesn’t help.

The only thing that consistently fixes it (at least temporarily) is restarting Windows.

I’ll keep monitoring to see if I can find a consistent trigger.

andhikadk avatar Sep 08 '25 01:09 andhikadk

I had a similar issue! The problem was permission-related - Codex couldn't create session files due to directory ownership issues.

Quick fix to try: sudo chown -R $USER:$USER ~/.codex/sessions/

What to check:

  • Look at ~/.codex/log/codex-tui.log for "Permission denied" errors
  • Check if ~/.codex/sessions/ directories have correct ownership

This happens when session directories get created with root permissions, preventing Codex from writing rollout files. The ownership fix usually resolves the stuck startup and keyboard issues.

Thanks for the tip! I do see a .codex folder on Windows as well. The CLI isn’t stuck right now, but if the bug happens again I’ll check the log/codex-tui.log and try looking into the sessions directory permissions. Will update here if I find anything.

andhikadk avatar Sep 08 '25 01:09 andhikadk

I encountered the same issue in the Windows environment, but in my case this problem occurs consistently. The codex-tui.log shows no exception logs at all - it doesn't even output any logs. Only when I rolled back the codex version to 0.22.0 did it work normally.

yuzixuan0722 avatar Sep 08 '25 15:09 yuzixuan0722

I have the same issue with verison 0.34.0. Successfully logged in using subscription plan, no welcome message, Ctrl-C don't work, I should write prompts, on Enter is no response and I can write another prompt. /status shows no tokens send or received. Downgrade to 0.22.0 helps

StithyStudios avatar Sep 14 '25 16:09 StithyStudios

Do either of you have MCP servers, by chance?

bolinfest avatar Sep 14 '25 22:09 bolinfest

Do either of you have MCP servers, by chance?

I don't use mcp server

andhikadk avatar Sep 15 '25 06:09 andhikadk

Do either of you have MCP servers, by chance?

I didn't use MCP either

yuzixuan0722 avatar Sep 15 '25 07:09 yuzixuan0722

The latest version 0.36.0 is working again

yuzixuan0722 avatar Sep 16 '25 03:09 yuzixuan0722

0.36.0 has the same issue for me, but I have resolved the issue!

As suggested in another thread with the same problem (affecting both CLI and the Codex extension for VS Code), I disabled the execution of bash.exe via the Windows security policy (gpedit).

After doing this, Codex CLI now uses powershell and works perfectly – no more issues with being stuck or broken keyboard shortcuts.

StithyStudios avatar Sep 17 '25 16:09 StithyStudios