openai/codex · error · io::Error

--profile `{active_user_profile}` cannot be used while {} co

Error message

--profile `{active_user_profile}` cannot be used while {} contains legacy `profile = "{active_user_profile}"` or `[profiles.{active_user_profile}]` config; move those settings into {} and remove the legacy profile selector/table. See https://developers.openai.com/codex/config-advanced#profiles for more information.

What it means

Error "--profile `{active_user_profile}` cannot be used while {} contains legacy `profile = "{active_user_profile}"` or `[profiles.{active_user_profile}]` config; move those settings into {} and remove the legacy profile selector/table. See https://developers.openai.com/codex/config-advanced#profiles for more information." thrown in openai/codex.

Source

Thrown at codex-rs/config/src/loader/mod.rs:335

        &base_user_file,
        /*profile*/ None,
        ignore_user_config,
        strict_config,
    )
    .await?;
    if let Some(active_user_profile) = active_user_profile.as_ref()
        && let Some(base_user_config) = base_user_layer.config.as_table()
    {
        let legacy_profile_is_selected = base_user_config
            .get("profile")
            .and_then(TomlValue::as_str)
            .is_some_and(|profile| profile == active_user_profile.as_str());
        let legacy_profile_table_exists = base_user_config
            .get("profiles")
            .and_then(TomlValue::as_table)
            .is_some_and(|profiles| profiles.contains_key(active_user_profile.as_str()));
        if legacy_profile_is_selected || legacy_profile_table_exists {
            return Err(io::Error::new(
                io::ErrorKind::InvalidData,
                format!(
                    "--profile `{active_user_profile}` cannot be used while {} contains legacy `profile = \"{active_user_profile}\"` or `[profiles.{active_user_profile}]` config; move those settings into {} and remove the legacy profile selector/table. See https://developers.openai.com/codex/config-advanced#profiles for more information.",
                    base_user_file.as_path().display(),
                    active_user_file.as_path().display()
                ),
            ));
        }
    }
    layers.push(base_user_layer);

    if active_user_file != base_user_file {
        layers.push(
            load_user_config_layer(
                fs,
                &active_user_file,
                active_user_profile.as_ref(),
                ignore_user_config,

View on GitHub (pinned to 339751715c)

Solutions

  1. Move the legacy profile settings into the new profile config file and remove the legacy `profile` selector or `[profiles.*]` table, as the message describes.

When it happens

Trigger: Thrown at codex-rs/config/src/loader/mod.rs:335 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/09ebdb1cfcca0d54. Report an issue: GitHub.