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

configured span attribute key must not be empty

Error message

configured span attribute key must not be empty

What it means

Validation in validate_span_attributes: an OTEL span attribute key is an empty string. Attributes are attached to every exported span, and an empty key is invalid OTLP attribute semantics, so configuration is rejected before installation.

Solutions

  1. Give the attribute a non-empty key in the telemetry config
  2. Remove the empty-keyed attribute entry
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/otel/src/config.rs:41 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/cb394d7ec5a20c13. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/otel/src/config.rs:41

            OtelExporter::OtlpHttp {
                endpoint: STATSIG_OTLP_HTTP_ENDPOINT.to_string(),
                headers: HashMap::from([(
                    STATSIG_API_KEY_HEADER.to_string(),
                    STATSIG_API_KEY.to_string(),
                )]),
                protocol: OtelHttpProtocol::Json,
                tls: None,
            }
        }
        _ => exporter.clone(),
    }
}

/// Validates configured span attributes before they are attached to exported spans.
pub fn validate_span_attributes(attributes: &BTreeMap<String, String>) -> std::io::Result<()> {
    if attributes.keys().any(String::is_empty) {
        return Err(std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            "configured span attribute key must not be empty",
        ));
    }

    Ok(())
}

#[derive(Clone, Debug)]
pub struct OtelSettings {
    pub environment: String,
    pub service_name: String,
    pub service_version: String,
    pub codex_home: PathBuf,
    pub exporter: OtelExporter,
    pub trace_exporter: OtelExporter,
    pub metrics_exporter: OtelExporter,
    pub runtime_metrics: bool,

View on GitHub (pinned to 339751715c)