openai/codex · error · anyhow::Error

`codex agents` does not accept an initial prompt or images

Error message

`codex agents` does not accept an initial prompt or images

What it means

Error "`codex agents` does not accept an initial prompt or images" thrown in openai/codex.

Source

Thrown at codex-rs/cli/src/main.rs:1101

    let root_strict_config = interactive.strict_config;
    interactive
        .shared
        .take_auto_review_config_overrides(&mut root_config_overrides);
    reject_root_strict_config_for_subcommand(root_strict_config, &subcommand)?;
    if let Some(subcommand) = subcommand.as_ref() {
        profile_v2_for_subcommand(&interactive, subcommand)?;
    }

    let open_agents_overview = matches!(&subcommand, Some(Subcommand::Agents(_)));
    match subcommand {
        None | Some(Subcommand::Agents(_)) => {
            prepend_config_flags(
                &mut interactive.config_overrides,
                root_config_overrides.clone(),
            );
            if open_agents_overview {
                if interactive.prompt.is_some() || !interactive.images.is_empty() {
                    anyhow::bail!("`codex agents` does not accept an initial prompt or images");
                }
                if root_remote.is_some()
                    && (interactive.oss
                        || interactive.oss_provider.is_some()
                        || !interactive.add_dir.is_empty()
                        || interactive
                            .config_overrides
                            .parse_overrides()
                            .map_err(anyhow::Error::msg)?
                            .iter()
                            .any(|(key, value)| {
                                key == "sandbox_workspace_write.writable_roots"
                                    || (key == "sandbox_workspace_write"
                                        && value.get("writable_roots").is_some())
                            }))
                {
                    anyhow::bail!(
                        "`codex agents` cannot apply local provider or additional-directory overrides to a remote server"

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/cli/src/main.rs:1101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/0a24068557db8ef7. Report an issue: GitHub.