openai/codex · error · MetricsError

invalid OTLP metrics configuration

Error message

invalid OTLP metrics configuration: {message}

What it means

thiserror variant of MetricsError: the OTLP metrics configuration supplied was invalid — the message interpolates the specific problem (e.g. malformed endpoint, bad timeout, invalid header) into "invalid OTLP metrics configuration: {message}".

Solutions

  1. Read the interpolated message for the exact offending field
  2. Correct the metrics exporter settings in the telemetry configuration
  3. Validate values (URLs, durations, header names) before loading config
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/otel/src/metrics/error.rs:29 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/01d797566812b906. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/otel/src/metrics/error.rs:29

    InvalidMetricName { name: String },
    #[error("{label} cannot be empty")]
    EmptyTagComponent { label: String },
    #[error("{label} contains invalid characters: {value}")]
    InvalidTagComponent { label: String, value: String },

    #[error("metrics exporter is disabled")]
    ExporterDisabled,

    #[error("counter increment must be non-negative for {name}: {inc}")]
    NegativeCounterIncrement { name: String, inc: i64 },

    #[error("failed to build OTLP metrics exporter")]
    ExporterBuild {
        #[source]
        source: opentelemetry_otlp::ExporterBuildError,
    },

    #[error("invalid OTLP metrics configuration: {message}")]
    InvalidConfig { message: String },

    #[error("failed to flush or shutdown metrics provider")]
    ProviderShutdown {
        #[source]
        source: opentelemetry_sdk::error::OTelSdkError,
    },

    #[error("runtime metrics snapshot reader is not enabled")]
    RuntimeSnapshotUnavailable,

    #[error("failed to collect runtime metrics snapshot from metrics reader")]
    RuntimeSnapshotCollect {
        #[source]
        source: opentelemetry_sdk::error::OTelSdkError,
    },
}

View on GitHub (pinned to 339751715c)