codex cloud fails with opaque 'Permission denied (os error 13)' when run headlessly

Resolved 💬 2 comments Opened Mar 23, 2026 by aquiles-ai123 Closed Mar 23, 2026

codex cloud fails with opaque Permission denied (os error 13) when run without a TTY

Summary

codex cloud exec --help tells the user to "see codex cloud to browse" environment ids.

But if codex cloud is run headlessly / without a TTY, it does not print a helpful "interactive TUI requires a terminal" message. It exits 1 with:

Error: Permission denied (os error 13)

That is especially confusing because the same command works under a TTY and opens the Cloud Tasks UI normally.

Repro

The help text points users to codex cloud:

codex cloud exec --help

Observed excerpt:

--env <ENV_ID>
    Target environment identifier (see `codex cloud` to browse)

Now run codex cloud headlessly:

codex cloud >/tmp/codex_cloud_notty.txt 2>&1
printf "outer_exit=%s\n" "$?"
cat /tmp/codex_cloud_notty.txt

Observed:

outer_exit=1
Error: Permission denied (os error 13)

Also reproduced with stdin detached:

codex cloud </dev/null >/tmp/codex_cloud_notty_nullin.txt 2>&1
printf "outer_exit=%s\n" "$?"
cat /tmp/codex_cloud_notty_nullin.txt

Observed:

outer_exit=1
Error: Permission denied (os error 13)

Control

With a TTY, codex cloud does launch the interactive UI instead of failing immediately.

Observed initial TTY output excerpt:

Cloud Tasks • All • 0%
...
↑/↓: Move  r: Refresh  Enter: Open  a: Apply  o : Set Env

Expected behavior

If codex cloud requires a TTY, it should fail with an explicit and actionable message such as:

  • "codex cloud requires an interactive terminal"
  • or a fallback noninteractive output

Actual behavior

Without a TTY, it exits with a generic Permission denied (os error 13) message that does not explain the real problem.

Why this matters

The CLI help explicitly points users to codex cloud to discover environments, but that path fails opaquely in headless contexts such as scripts, remote runners, or automation shells.

Files / artifacts

  • /tmp/codex_cloud_notty.txt
  • /tmp/codex_cloud_notty_nullin.txt

View original on GitHub ↗

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