{"record":{"id":"0b9f4646b00f5c12","repo":"dbt-labs/dbt-core","slug":"telemetry-hasn-t-been-properly-initialized-missin-0b9f46","errorCode":null,"errorMessage":"Telemetry hasn't been properly initialized. Missing span start info","messagePattern":"Telemetry hasn't been properly initialized\\. Missing span start info","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-tracing/src/span_info.rs","lineNumber":470,"sourceCode":"///\n/// If the span doesn't have start info (i.e., the span wasn't\n/// properly initialized or telemetry hasn't been set up).\n///\n/// # Example\n///\n/// ```ignore\n/// read_span_start_info(&span, |info| {\n///     println!(\"Trace ID: {:?}\", info.trace_id);\n///     println!(\"Span ID: {}\", info.span_id);\n///     info.span_id\n/// })\n/// ```\npub fn read_span_start_info<R>(span: &Span, reader: impl FnOnce(&SpanStartInfo) -> R) -> Option<R> {\n    with_span(span, |span_ref| {\n        let span_ext = span_ref.extensions();\n        let info = span_ext\n            .get::<DLSpanStartInfo>()\n            .expect(\"Telemetry hasn't been properly initialized. Missing span start info\");\n\n        reader(info)\n    })\n}\n\n/// Reads span start info from the current span with read-only access.\n///\n/// This provides immutable access to the current span's start information\n/// including trace_id, span_id, span_name, and other metadata. The data layer\n/// guarantees that this information cannot be modified through this API.\n///\n/// Returns `None` if there is no current span or the span doesn't have start\n/// info (e.g., the span wasn't properly initialized or telemetry hasn't been\n/// set up).\n///\n/// # Example\n///\n/// ```ignore","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-tracing/src/span_info.rs#L452-L488","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet span = tracing::info_span!(\"node\");\ncreate_node_processed_on_task_close(&span, ...); // panics\n\n// after\nlet _g = dbt_tracing::init_telemetry(...)?;\nlet span = dbt_tracing::instrumented_span(\"node\");\ncreate_node_processed_on_task_close(&span, ...);","handlingStrategy":"validation","validationCode":"assert!(dbt_tracing::telemetry_initialized(), \"call dbt_tracing::init_telemetry before creating spans\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["telemetry","tracing","panic","initialization-order"],"backgroundTag":"internal-invariant-violation","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}