openai/codex · error · MetricsError

failed to build OTLP metrics exporter

Error message

failed to build OTLP metrics exporter

What it means

thiserror variant MetricsError::ExporterBuild: the opentelemetry-otlp metrics exporter failed to construct (exporter configuration, endpoint, TLS, or credentials were rejected by the opentelemetry_otlp builder). The underlying ExporterBuildError is attached as #[source].

Solutions

  1. Inspect the source ExporterBuildError for the exact builder failure
  2. Validate the OTLP metrics endpoint, protocol, headers, and TLS settings
  3. Test the endpoint URL is reachable and well-formed
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

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

#[derive(Debug, Error)]
pub enum MetricsError {
    // Metrics.
    #[error("metric name cannot be empty")]
    EmptyMetricName,
    #[error("metric name contains invalid characters: {name}")]
    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")]

View on GitHub (pinned to 339751715c)