{"record":{"id":"0fe501bc646679e8","repo":"vectordotdev/vector","slug":"topology-is-missing-the-utilization-metric-emitter","errorCode":null,"errorMessage":"Topology is missing the utilization metric emitter!","messagePattern":"Topology is missing the utilization metric emitter!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/topology/running.rs","lineNumber":1420,"sourceCode":"        if let Err(error) = crate::metrics::Controller::get()\n            .expect(\"Metrics must be initialized\")\n            .set_expiry(\n                expire_metrics,\n                config\n                    .global\n                    .expire_metrics_per_metric_set\n                    .clone()\n                    .unwrap_or_default(),\n            )\n        {\n            error!(message = \"Invalid metrics expiry.\", %error, internal_log_rate_limit = false);\n            return None;\n        }\n\n        let (utilization_emitter, utilization_registry) = pieces\n            .utilization\n            .take()\n            .expect(\"Topology is missing the utilization metric emitter!\");\n        let metrics_storage = pieces.metrics_storage.clone();\n        let metrics_refresh_period = config\n            .global\n            .metrics_storage_refresh_period\n            .map(Duration::from_secs_f64);\n        let mut running_topology = Self::new(config, abort_tx);\n\n        if !running_topology\n            .run_healthchecks(&diff, &mut pieces, running_topology.config.healthchecks)\n            .await\n        {\n            return None;\n        }\n        running_topology.connect_diff(&diff, &mut pieces);\n        running_topology.spawn_diff(&diff, pieces);\n        // `running_topology.config` was set from the initial config in `new()`.\n        running_topology.refresh_confinement_gauges();\n","sourceCodeStart":1402,"sourceCodeEnd":1438,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/topology/running.rs#L1402-L1438","documentation":"`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.","triggerScenarios":"Calling `start_validated` twice on the same `TopologyPieces` (the `take()` already emptied it), or constructing pieces manually without a utilization emitter.","commonSituations":"Embedded usage that reuses TopologyPieces across restarts; custom builder code that skips the utilization emitter setup.","solutions":["Start each topology with freshly built TopologyPieces; never reuse pieces after a previous start.","When constructing TopologyPieces manually, always initialize the utilization emitter and registry.","Audit any custom build path to confirm it uses the same builder code path as `build_topology`."],"exampleFix":"// before\nlet pieces = build_pieces(&config)?;\nRunningTopology::start_validated(config.clone(), abort_tx).await?; // takes utilization\nRunningTopology::start_validated(config, abort_tx).await?; // panics: already taken\n\n// after\nlet pieces = build_pieces(&config)?;\nRunningTopology::start_validated(config, abort_tx).await?; // one start per pieces","handlingStrategy":"validation","validationCode":"assert!(pieces.utilization.is_some(), \"TopologyPieces missing utilization emitter; rebuild pieces\");","typeGuard":"fn pieces_fresh(pieces: &TopologyPieces) -> bool { pieces.utilization.is_some() }","tryCatchPattern":null,"preventionTips":["Use TopologyPieces exactly once; rebuild via build_topology for each start.","Never construct TopologyPieces manually without the utilization emitter.","Route all builds through the standard builder entry point."],"tags":["rust","metrics","topology","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}