codex exec --image swallows the positional prompt → "No prompt provided via stdin"

Open 💬 2 comments Opened Jun 25, 2026 by andrew-stelmach-fleet

What

codex exec --image <file> "<prompt>" exits with No prompt provided via stdin even though a prompt was passed.

Repro (codex-cli 0.142.0)

codex exec --image screenshot.png "describe this image"
# Reading prompt from stdin...
# No prompt provided via stdin.   (exit 1)

Why

The shared --image flag (codex-rs/utils/cli/src/shared_options.rs) is declared num_args = 1.. (greedy), so it consumes the trailing positional [PROMPT] as another image path. With no positional prompt left, Codex falls back to (empty) stdin and exits.

The resume subcommand's image arg already uses num_args = 1 and is unaffected, so the bug only hits the fresh top-level codex exec path.

Proposed fix

Set num_args = 1 on the shared arg (consistent with resume). Comma (--image a,b) and repeated (-i a -i b) forms still work; only the undocumented space-separated form is dropped (now a clear parse error). Happy to PR — branch ready.

View original on GitHub ↗

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