openai/codex · error · anyhow::Error

failed to initialize WFP setup metrics provider

Error message

failed to initialize WFP setup metrics provider: {err}

What it means

The WFP setup helper failed to construct its OTEL metrics provider from the OtelSettings passed in the elevation payload (the error is chained via {err}). Telemetry initialization in the elevated helper is best-effort; failing to start the provider propagates rather than being silently dropped.

Solutions

  1. Inspect the inner error, ensure the WFP provider can be registered (elevation required), and retry the sandbox network setup.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/wfp_setup.rs:61 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/3e83403b9304ca9f. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/wfp_setup.rs:61

        return Ok(None);
    };
    // The setup helper cannot call codex-core's OTEL builder because core
    // depends on this crate, so the parent process passes only the resolved
    // Statsig environment in the elevation payload. Other exporters are
    // intentionally omitted from this helper path.
    OtelProvider::try_new(&OtelSettings {
        environment: otel.environment.clone(),
        service_name: WFP_SETUP_SERVICE_NAME.to_string(),
        service_version: env!("CARGO_PKG_VERSION").to_string(),
        codex_home: codex_home.to_path_buf(),
        exporter: OtelExporter::None,
        trace_exporter: OtelExporter::None,
        metrics_exporter: OtelExporter::Statsig,
        runtime_metrics: false,
        span_attributes: BTreeMap::new(),
        tracestate: BTreeMap::new(),
    })
    .map_err(|err| anyhow::anyhow!("failed to initialize WFP setup metrics provider: {err}"))
}

fn emit_wfp_setup_metric(
    codex_home: &Path,
    otel: Option<&StatsigMetricsSettings>,
    metric: &WfpSetupMetric,
) -> Result<()> {
    let Some(provider) = build_wfp_metrics_provider(codex_home, otel)? else {
        return Ok(());
    };
    if let Some(metrics) = provider.metrics() {
        let target_account = sanitize_setup_metric_tag_value(&metric.target_account);
        match metric.outcome {
            WfpSetupMetricOutcome::Success => {
                let installed_filter_count = metric.installed_filter_count.to_string();
                metrics.counter(
                    WFP_SETUP_SUCCESS_METRIC,
                    /*inc*/ 1,

View on GitHub (pinned to 339751715c)