openai/codex · error · ConfigManagerError

{message}

Error message

{message}

What it means

After config loads, run_main builds the OpenTelemetry provider via otel_init::build_provider; failures — malformed OTEL_* environment variables such as an invalid OTEL_EXPORTER_OTLP_ENDPOINT, badly formatted OTEL_EXPORTER_OTLP_HEADERS, or telemetry config keys with wrong types — are wrapped as ErrorKind::InvalidData (codex-rs/mcp-server/src/lib.rs:93). Telemetry setup is treated as load-bearing, so one bad otel setting aborts startup.

Source

Thrown at codex-rs/app-server/src/config_manager_service.rs:46

use codex_core::config::validate_feature_requirements_for_config_toml;
use codex_core::path_utils;
use codex_core::path_utils::SymlinkWritePaths;
use codex_core::path_utils::resolve_symlink_write_paths;
use codex_core::path_utils::write_atomically;
use codex_protocol::protocol::AskForApproval;
use codex_utils_absolute_path::AbsolutePathBuf;
use serde_json::Value as JsonValue;
use std::borrow::Cow;
use std::path::Path;
use std::path::PathBuf;
use thiserror::Error;
use tokio::task;
use toml::Value as TomlValue;
use toml_edit::Item as TomlItem;

#[derive(Debug, Error)]
pub(crate) enum ConfigManagerError {
    #[error("{message}")]
    Write {
        code: ConfigWriteErrorCode,
        message: String,
    },

    #[error("{context}: {source}")]
    Io {
        context: &'static str,
        #[source]
        source: std::io::Error,
    },

    #[error("{context}: {source}")]
    Json {
        context: &'static str,
        #[source]
        source: serde_json::Error,
    },

View on GitHub (pinned to 339751715c)

Solutions

  1. Read the embedded {e} cause and fix the named env var or config key.
  2. Unset the OTEL_* variables (or clear the otel config block) and retry to confirm they are the source.
  3. Validate endpoint URLs and header pair formats against the OTLP env spec.
  4. Check analytics-enabled defaults if config sets telemetry keys.

Example fix

# before
export OTEL_EXPORTER_OTLP_ENDPOINT="http::/localhost:4317"
# after
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
Defensive patterns

Strategy: try-catch

Validate before calling

fn otel_env_sane() -> Result<(), String> {
    if let Ok(ep) = std::env::var("OTEL_EXPORTER_OTLP_ENDPOINT") {
        url::Url::parse(&ep).map_err(|e| format!("bad OTEL endpoint: {e}"))?;
    }
    if let Ok(h) = std::env::var("OTEL_EXPORTER_OTLP_HEADERS") {
        for pair in h.split(',') {
            pair.split_once('=').ok_or_else(|| format!("bad header pair {pair}"))?;
        }
    }
    Ok(())
}

Try / catch

match run_main(args, overrides, strict).await {
    Err(e) if e.kind() == std::io::ErrorKind::InvalidData
        && e.to_string().contains("otel config") =>
    {
        // print OTEL_* env hints and the embedded cause, then exit nonzero
    }
    other => other,
}

Prevention

When it happens

Trigger: Starting codex mcp-server with a malformed OTEL_EXPORTER_OTLP_ENDPOINT (not a valid URL), OTEL_EXPORTER_OTLP_HEADERS that are not key=value pairs, or analytics/otel config keys carrying wrong value types.

Common situations: Copying OTEL env vars between runtimes with different formats; trailing spaces or quotes in endpoint URLs; version drift where otel config key names or semantics changed.

Related errors


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