{"record":{"id":"c370a3ad6383d98a","repo":"vectordotdev/vector","slug":"telemetry-collector-task-should-not-panic","errorCode":null,"errorMessage":"telemetry collector task should not panic","messagePattern":"telemetry collector task should not panic","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/validation/runner/telemetry.rs","lineNumber":164,"sourceCode":"\n            telemetry_completed.mark_as_done();\n\n            telemetry_events\n        });\n\n        TelemetryCollector { driver_handle }\n    }\n}\n\npub struct TelemetryCollector {\n    driver_handle: JoinHandle<Vec<Event>>,\n}\n\nimpl TelemetryCollector {\n    pub async fn collect(self) -> Vec<Event> {\n        self.driver_handle\n            .await\n            .expect(\"telemetry collector task should not panic\")\n    }\n}\n","sourceCodeStart":146,"sourceCodeEnd":167,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/components/validation/runner/telemetry.rs#L146-L167","documentation":"TelemetryCollector::collect awaits the JoinHandle of the background telemetry driver task and asserts it finished normally. If the JoinHandle returns Err (JoinError), the telemetry collection task panicked or was cancelled, meaning collected telemetry (metrics/logs/events) is incomplete and cannot be trusted.","triggerScenarios":"Calling collect() after the telemetry driver task panicked — e.g. a panic while parsing scraped metrics endpoints, a poisoned shared structure, or the task being aborted during teardown in run_validation.","commonSituations":"A component emits malformed metrics that trip the telemetry parser; test aborts/cancellations racing collector shutdown; regressions inside the telemetry driver after refactoring.","solutions":["Capture the JoinError (unwrap_or_else on the await) and inspect its panic payload to find the panicking line in the telemetry driver.","Fix the telemetry driver code path that panicked (often metrics parsing of edge-case component output).","Ensure collect() is only called after a graceful shutdown so the task isn't aborted mid-flight."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let events = self.driver_handle.await\n    .unwrap_or_else(|e| panic!(\"telemetry collector panicked: {e:?}\"));","preventionTips":["Keep telemetry parsing robust to unusual metric shapes emitted by components.","Only call collect() after coordinated shutdown completes, never mid-teardown.","Inspect JoinError panic payloads to locate the failing driver line quickly."],"tags":["telemetry","panic","task"],"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"}