dbt-labs/dbt-core · error
Telemetry hasn't been properly initialized. Missing span sta
Error message
Telemetry hasn't been properly initialized. Missing span start info
What it means
Panic from `.expect()` in `read_span_start_info`: the span's extensions do not contain `DLSpanStartInfo`. The telemetry layer records start info (name, target, timing) when a span is created; reading it on a span created without that layer is an unrecoverable initialization bug, so the library panics rather than returning garbage.
Source
Thrown at crates/dbt-tracing/src/span_info.rs:470
///
/// If the span doesn't have start info (i.e., the span wasn't
/// properly initialized or telemetry hasn't been set up).
///
/// # Example
///
/// ```ignore
/// read_span_start_info(&span, |info| {
/// println!("Trace ID: {:?}", info.trace_id);
/// println!("Span ID: {}", info.span_id);
/// info.span_id
/// })
/// ```
pub fn read_span_start_info<R>(span: &Span, reader: impl FnOnce(&SpanStartInfo) -> R) -> Option<R> {
with_span(span, |span_ref| {
let span_ext = span_ref.extensions();
let info = span_ext
.get::<DLSpanStartInfo>()
.expect("Telemetry hasn't been properly initialized. Missing span start info");
reader(info)
})
}
/// Reads span start info from the current span with read-only access.
///
/// This provides immutable access to the current span's start information
/// including trace_id, span_id, span_name, and other metadata. The data layer
/// guarantees that this information cannot be modified through this API.
///
/// Returns `None` if there is no current span or the span doesn't have start
/// info (e.g., the span wasn't properly initialized or telemetry hasn't been
/// set up).
///
/// # Example
///
/// ```ignoreView on GitHub (pinned to 0267ce9170)
Solutions
- Install the dbt telemetry layer (which populates `DLSpanStartInfo` on `on_new_span`) before creating any spans read by node-processing callbacks.
- Verify telemetry initialization actually succeeded — check init result/logs rather than ignoring errors.
- If telemetry is intentionally disabled, bypass the `create_node_processed_on_task_*` helpers that require start info.
- Confirm the span handle passed to `read_span_start_info` was created by library-instrumented code, not a raw tracing span.
Example fix
// before
let span = tracing::info_span!("node");
create_node_processed_on_task_close(&span, ...); // panics
// after
let _g = dbt_tracing::init_telemetry(...)?;
let span = dbt_tracing::instrumented_span("node");
create_node_processed_on_task_close(&span, ...); Defensive patterns
Strategy: validation
Validate before calling
assert!(dbt_tracing::telemetry_initialized(), "call dbt_tracing::init_telemetry before creating spans");
Prevention
- Initialize telemetry before any span creation in every entry point.
- Confirm init success; do not swallow init errors.
- Gate node-processing callbacks when telemetry is disabled by config.
When it happens
Trigger: Calling `read_span_start_info` on a span that was not created under the dbt telemetry layer — e.g. `create_node_processed_on_task_close` or `create_node_processed_on_task_skip` invoked with a manually created span or after telemetry init was skipped/disabled.
Common situations: Unit tests constructing spans directly with `tracing::info_span!` without the telemetry subscriber; processes where telemetry setup failed silently or was disabled via env/config; spans crossing from a runtime initialized before telemetry 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
- attrs_updater should only be called once
- Parent span must have a SpanStartInfo record in its extensio
- Parquet writer is not initialized
- Failed to serialize core event info to JSON
- test tracing subscriber should be valid
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/0b9f4646b00f5c12.
Report an issue: GitHub.