dbt-labs/dbt-core · error
DbtUnitTest does not support setting detected_unsafe
Error message
DbtUnitTest does not support setting detected_unsafe
What it means
DbtUnitTest's set_detected_introspection is an intentional hard panic: unit tests are declarative test definitions with nothing to introspect on the warehouse, so detected-unsafe/introspection state cannot be set. The panic fires only when generic node code wrongly reaches this node kind.
Solutions
- Check the node kind before calling the introspection setter and skip DbtUnitTest
- Gate the code path to node types that support warehouse introspection
- Make the method a no-op instead of a panic if silent skipping is acceptable
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/dbt-schemas/src/schemas/nodes.rs:2220 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/c3d9c192a0e8ceb0.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-schemas/src/schemas/nodes.rs:2220
"unit_test",
[(
"same_fqn",
same_fqn_result,
Some((
format!("{:?}", &self.common().fqn),
format!("{:?}", &other_unit_test.common().fqn),
)),
)],
);
}
result
} else {
false
}
}
fn set_detected_introspection(&mut self, _introspection: IntrospectionKind) {
panic!("DbtUnitTest does not support setting detected_unsafe");
}
}
fn same_unit_test_definition(_self_ut: &DbtUnitTest, _other_ut: &DbtUnitTest) -> bool {
// This dummy implementation makes explicit Fusion's current unit-test content under-selection:
true
// TODO: Implement parity with dbt-core's flagging a unit test on a checksum over
// model/versions/given/expect/overrides (+ fixture rows) — build_unit_test_checksum,
// dbt-mantle core/dbt/contracts/graph/nodes.py:1226.
// HAZARD when fixing: do NOT naively compare `checksum`. dbt-core manifests carry a real
// unit-test checksum while Fusion emits DbtChecksum::default(); comparing them directly would
// over-select every unit test against a dbt-core state manifest. The fix must populate Fusion's
// unit-test checksum consistently first, then compare.
}
impl InternalDbtNodeAttributes for DbtUnitTest {
fn search_name(&self) -> String {
// Based on Python implementation, unit tests can have a versioned nameView on GitHub (pinned to 0267ce9170)