dbt-labs/dbt-core · error
array definition should become a union
Error message
array definition should become a union
What it means
Test-only assertion in test_serialize_selector_definition_array_as_union: an array-valued selector definition must serialize as a `union` sequence in the YAML output. Fires only if array definitions stop being converted to union form.
Solutions
- Fix selector_definition_to_yaml to map Array definitions to a union
- Add coverage for multi-element arrays if missing
- Treat failure as a selector serialization regression
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:657 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/6c50c8d650d11761.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:657
assert_eq!(
yaml.get("method").and_then(|v| v.as_str()),
Some("config.materialized")
);
}
#[test]
fn test_serialize_selector_definition_array_as_union() {
let definition = SelectorDefinitionValue::Array(vec![
SelectorDefinitionValue::String("a".to_string()),
SelectorDefinitionValue::String("b".to_string()),
]);
let yaml = selector_definition_to_yaml(&definition).unwrap();
let sequence = yaml
.get("union")
.and_then(|value| value.as_sequence())
.expect("array definition should become a union");
assert_eq!(sequence.len(), 2);
assert_eq!(sequence[0].get("value").and_then(|v| v.as_str()), Some("a"));
assert_eq!(sequence[1].get("value").and_then(|v| v.as_str()), Some("b"));
}
#[test]
fn test_serialize_method_key_requires_one_entry() {
let method_value = BTreeMap::from([
("selector".to_string(), SelectorValue::from("base").into()),
("fqn".to_string(), SelectorValue::from("other").into()),
]);
let atom = AtomExpr::MethodKey(method_value);
assert!(selector_atom_to_yaml(&atom).is_err());
}
#[test]
fn test_manifest_selector_preserves_union_with_inline_exclude_shape() -> FsResult<()> {View on GitHub (pinned to 0267ce9170)