openai/codex · error · anyhow::Error

`codex agents` cannot apply local provider or…

Error message

`codex agents` cannot apply local provider or additional-directory overrides to a remote server

What it means

Guard for `codex agents` with a remote target: local-only options (--oss/--oss-provider, --add-dir, or config overrides like sandbox_workspace_write.writable_roots) cannot be honored on a remote server, so the combination is rejected.

Solutions

  1. Remove the local provider/add-dir/config overrides when using --remote
  2. Apply those settings in the remote server's own configuration
  3. Run `codex agents` locally if you need local overrides
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/cli/src/main.rs:1118 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/600a77af9cc3e30d. Report an issue: GitHub.

Appendix: source

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

                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"
                    );
                }
                if is_workload_identity_selected() {
                    anyhow::bail!(
                        "`codex agents` is unavailable while workload identity is active"
                    );
                }
                if root_remote.is_none() {
                    resolve_remote_endpoint(
                        /*remote*/ None,
                        root_remote_auth_token_env.clone(),
                    )?;
                    #[cfg(not(unix))]
                    anyhow::bail!("`codex agents` requires `--remote` on this platform");
                }
                interactive.agents_overview = true;
            }

View on GitHub (pinned to 339751715c)