codex CLI fails to start in non-tty (Jupyter notebook) environments due to raw-mode requirement

Resolved 💬 2 comments Opened Jun 3, 2025 by zazula Closed Oct 16, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

Summary

When launching codex CLI in a Jupyter notebook (or other non-tty environments), it fails to start with the following error:

ERROR Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
Read about how to prevent this error on
https://github.com/vadimdemedes/ink/#israwmodesupported

Steps to reproduce

  1. Open a Jupyter notebook environment.
  2. Run !codex --session-mode new --skip-ask-mode.

Expected Behavior

Codex CLI should detect the absence of a tty and either:

  • fallback to a plain text mode
  • or provide instructions to disable raw mode or use a flag.

Actual Behavior

Codex CLI immediately errors out and does not provide a usable fallback.

Environment

  • codex version: 0.0.0-dev
  • Node.js version: v24.1.0
  • Jupyter notebook
  • Platform: $(uname -a)

Suggested Fix

Consider detecting non-tty stdin and:

  • Automatically disable Ink's raw-mode and degrade to a plain logging mode.
  • Or provide a --no-tty flag to disable raw-mode.

View original on GitHub ↗

2 Comments

petrosoft-fi · 1 year ago

⚠️ Same underlying issue in #1080, #1156, and #1208 (also reproducible in AWS Lambda)

All three reports crash with the identical Ink error:

Error: Raw mode is not supported on the current process.stdin …

The Codex CLI calls stdin.setRawMode(true) via Ink’s useInput.
If the process has no real TTY (CI runners, Jupyter/Colab, Lambda, Docker without -t) Ink throws and Codex exits before any flags are parsed.

➡️ There is no reliable headless work-around yet

• Setting CI=true and passing --yes --allow-outside-git --approval-mode full-auto is not sufficient—Ink still initialises useInput and the CLI crashes.
• Same result in Lambda, GitHub Actions, Azure Functions, and Colab notebooks.

🛠 Proposed fix for the CLI

  1. Provide an official --ci / --headless flag (or honour CI=true) that completely disables Ink’s useInput before raw-mode is attempted.
  2. Make that flag automatically imply --yes and --allow-outside-git.
  3. Document usage for CI/CD environments (Actions, GitLab, Lambda, etc.).

Until then the only viable option is:

Run Codex CLI inside an environment that has a TTY (e.g. self-hosted runner with docker run -it …).

tibo-openai collaborator · 10 months ago

Closing as obsolete since the migration to codex-rs