openai/codex · error · std::io::Error

error loading config

Error message

error loading config: {e}

What it means

ConfigBuilder::build failed while loading the effective configuration for the MCP server (config.toml plus CLI overrides under strict mode). The wrapped error carries the underlying config error — commonly unknown keys under strict_config, bad TOML, or invalid values.

Solutions

  1. Read the wrapped error {e} to identify the offending config key or file
  2. Fix or remove the reported key in config.toml
  3. If using strict mode, ensure all keys are recognized by this codex version
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/mcp-server/src/lib.rs:82 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/2cbed9465e99ef61. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/mcp-server/src/lib.rs:82

    cli_config_overrides: CliConfigOverrides,
    strict_config: bool,
) -> IoResult<()> {
    reject_workload_identity(codex_login::is_workload_identity_selected())?;
    // Parse CLI overrides once and derive the base Config eagerly so later
    // components do not need to work with raw TOML values.
    let cli_kv_overrides = cli_config_overrides.parse_overrides().map_err(|e| {
        std::io::Error::new(
            ErrorKind::InvalidInput,
            format!("error parsing -c overrides: {e}"),
        )
    })?;
    let config = ConfigBuilder::default()
        .cli_overrides(cli_kv_overrides)
        .strict_config(strict_config)
        .build()
        .await
        .map_err(|e| {
            std::io::Error::new(ErrorKind::InvalidData, format!("error loading config: {e}"))
        })?;
    config.auth_config().validate()?;
    set_default_client_residency_requirement(config.enforce_residency.value());
    let otel = codex_core::otel_init::build_provider(
        &config,
        env!("CARGO_PKG_VERSION"),
        Some(OTEL_SERVICE_NAME),
        DEFAULT_ANALYTICS_ENABLED,
    )
    .map_err(|e| {
        std::io::Error::new(
            ErrorKind::InvalidData,
            format!("error loading otel config: {e}"),
        )
    })?;
    codex_core::otel_init::record_process_start(otel.as_ref(), OTEL_SERVICE_NAME);
    codex_core::otel_init::install_sqlite_telemetry(otel.as_ref(), OTEL_SERVICE_NAME);
    let state_db = codex_core::init_state_db(&config).await;

View on GitHub (pinned to 339751715c)