dbt-labs/dbt-core · error
Downcast failed
Error message
Downcast failed
What it means
Test helper assertion in assert_dyn_eq: after downcasting the boxed dyn ComponentConfig back to its concrete type T via as_any().downcast_ref(), the downcast returned None. This guard verifies the Any plumbing of component configs; it fails only if T does not match the boxed component's concrete type.
Solutions
- Ensure assert_dyn_eq is called with the same concrete type that was boxed
- Check that SimpleComponentConfigImpl implements as_any returning the correct Self type
- Treat failure as a test-helper misuse, not a runtime error
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/dbt-adapter/src/relation/config_v2.rs:771 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/25f3bdb936484327.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-adapter/src/relation/config_v2.rs:771
fn eq(&self, other: &Self) -> bool {
self.value == other.value
}
}
impl<T: Eq + fmt::Debug + Send + Sync + Any + Clone> Eq for SimpleComponentConfigImpl<T> {}
fn custom_diff(desired_state: &u8, current_state: &u8) -> Option<u8> {
let diff = desired_state - current_state;
if diff != 0 { Some(diff) } else { None }
}
fn assert_dyn_eq<T: Clone + Eq + fmt::Debug + 'static>(a: T, b: Box<dyn ComponentConfig>) {
assert_eq!(
a,
b.as_ref()
.as_any()
.downcast_ref::<T>()
.expect("Downcast failed")
.clone()
)
}
fn assert_component_config_change_eq<T: fmt::Debug + PartialEq + 'static>(
a: &ComponentConfigChange,
b: &ComponentConfigChange,
) {
assert_eq!(std::mem::discriminant(a), std::mem::discriminant(b));
if let (ComponentConfigChange::Some(a_diff), ComponentConfigChange::Some(b_diff)) = (a, b) {
assert_eq!(
a_diff.as_any().downcast_ref::<T>(),
b_diff.as_any().downcast_ref::<T>()
);
}
}
fn return_true(_: &IndexMap<&'static str, ComponentConfigChange>) -> bool {View on GitHub (pinned to 0267ce9170)