vectordotdev/vector · critical

Topology is missing the utilization metric emitter!

Error message

Topology is missing the utilization metric emitter!

What it means

`start_validated` takes `pieces.utilization` and panics if the topology builder did not produce a utilization metric emitter (src/topology/running.rs:1420). `TopologyPieces.utilization` is expected to always be populated during build; a `None` here means the pieces were constructed incompletely or already consumed.

Solutions

  1. Start each topology with freshly built TopologyPieces; never reuse pieces after a previous start.
  2. When constructing TopologyPieces manually, always initialize the utilization emitter and registry.
  3. Audit any custom build path to confirm it uses the same builder code path as `build_topology`.

Example fix

// before
let pieces = build_pieces(&config)?;
RunningTopology::start_validated(config.clone(), abort_tx).await?; // takes utilization
RunningTopology::start_validated(config, abort_tx).await?; // panics: already taken

// after
let pieces = build_pieces(&config)?;
RunningTopology::start_validated(config, abort_tx).await?; // one start per pieces
Defensive patterns

Strategy: validation

Validate before calling

assert!(pieces.utilization.is_some(), "TopologyPieces missing utilization emitter; rebuild pieces");

Type guard

fn pieces_fresh(pieces: &TopologyPieces) -> bool { pieces.utilization.is_some() }

Prevention

When it happens

Trigger: Calling `start_validated` twice on the same `TopologyPieces` (the `take()` already emptied it), or constructing pieces manually without a utilization emitter.

Common situations: Embedded usage that reuses TopologyPieces across restarts; custom builder code that skips the utilization emitter setup.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/0fe501bc646679e8. Report an issue: GitHub.

Appendix: source

Thrown at src/topology/running.rs:1420

        if let Err(error) = crate::metrics::Controller::get()
            .expect("Metrics must be initialized")
            .set_expiry(
                expire_metrics,
                config
                    .global
                    .expire_metrics_per_metric_set
                    .clone()
                    .unwrap_or_default(),
            )
        {
            error!(message = "Invalid metrics expiry.", %error, internal_log_rate_limit = false);
            return None;
        }

        let (utilization_emitter, utilization_registry) = pieces
            .utilization
            .take()
            .expect("Topology is missing the utilization metric emitter!");
        let metrics_storage = pieces.metrics_storage.clone();
        let metrics_refresh_period = config
            .global
            .metrics_storage_refresh_period
            .map(Duration::from_secs_f64);
        let mut running_topology = Self::new(config, abort_tx);

        if !running_topology
            .run_healthchecks(&diff, &mut pieces, running_topology.config.healthchecks)
            .await
        {
            return None;
        }
        running_topology.connect_diff(&diff, &mut pieces);
        running_topology.spawn_diff(&diff, pieces);
        // `running_topology.config` was set from the initial config in `new()`.
        running_topology.refresh_confinement_gauges();

View on GitHub (pinned to bdb87aeaa4)