vectordotdev/vector · error

telemetry collector task should not panic

Error message

telemetry collector task should not panic

What it means

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.

Solutions

  1. Capture the JoinError (unwrap_or_else on the await) and inspect its panic payload to find the panicking line in the telemetry driver.
  2. Fix the telemetry driver code path that panicked (often metrics parsing of edge-case component output).
  3. Ensure collect() is only called after a graceful shutdown so the task isn't aborted mid-flight.
Defensive patterns

Strategy: try-catch

Try / catch

let events = self.driver_handle.await
    .unwrap_or_else(|e| panic!("telemetry collector panicked: {e:?}"));

Prevention

When it happens

Trigger: 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.

Common situations: A component emits malformed metrics that trip the telemetry parser; test aborts/cancellations racing collector shutdown; regressions inside the telemetry driver after refactoring.

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/c370a3ad6383d98a. Report an issue: GitHub.

Appendix: source

Thrown at src/components/validation/runner/telemetry.rs:164

            telemetry_completed.mark_as_done();

            telemetry_events
        });

        TelemetryCollector { driver_handle }
    }
}

pub struct TelemetryCollector {
    driver_handle: JoinHandle<Vec<Event>>,
}

impl TelemetryCollector {
    pub async fn collect(self) -> Vec<Event> {
        self.driver_handle
            .await
            .expect("telemetry collector task should not panic")
    }
}

View on GitHub (pinned to bdb87aeaa4)