codex exec hangs when not OPENAI_API_KEY supplied

Resolved 💬 2 comments Opened Jul 14, 2025 by dn-scribe Closed Aug 18, 2025

What version of Codex is running?

0.6.0

Which model were you using?

codex-mini-latest

What platform is your computer?

MacOS, Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

Assure no OPENAI_API_KEY
Run
codex exec "solve the halting problem"

Seems to be hanged:

[2025-07-14T19:11:04] OpenAI Codex v0.6.0 (research preview)
--------
workdir: XXX
model: codex-mini-latest
provider: openai
approval: Never
sandbox: read-only
reasoning effort: medium
reasoning summaries: auto
--------
[2025-07-14T19:11:04] User instructions:
solve the halting problem
[2025-07-14T19:11:04] ERROR: Missing environment variable: `OPENAI_API_KEY`. Create an API key (https://platform.openai.com) and export it as an environment variable.


### What is the expected behavior?

Exit immediately with error.

### What do you see instead?

Nothing.

### Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗