dbt-labs/dbt-core · error
expected `union` sequence inside exclude
Error message
expected `union` sequence inside exclude
What it means
Test-only assertion in test_serialize_atom_with_nested_exclude: the serialized selector atom's `exclude` entry must contain a `union` sequence as its single element. Fires only if selector YAML serialization flattens or drops the nested union inside exclude.
Solutions
- Fix selector_atom_to_yaml to nest the union inside the exclude list
- Re-run the selector serialization tests
- Treat failure as a selector YAML shape regression
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:606 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/cec7bdc492b16944.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:606
]))),
));
let yaml = select_expression_to_yaml(&expr);
assert_eq!(yaml.get("method").and_then(|v| v.as_str()), Some("fqn"));
assert_eq!(yaml.get("value").and_then(|v| v.as_str()), Some("*"));
// `exclude` must be a single-element list wrapping the union.
let exclude = yaml
.get("exclude")
.and_then(|v| v.as_sequence())
.expect("expected `exclude` sequence in serialized atom");
assert_eq!(exclude.len(), 1);
let union = exclude[0]
.get("union")
.and_then(|v| v.as_sequence())
.expect("expected `union` sequence inside exclude");
let mut tags: Vec<String> = union
.iter()
.map(|item| {
assert_eq!(item.get("method").and_then(|v| v.as_str()), Some("tag"));
item.get("value")
.and_then(|v| v.as_str())
.unwrap()
.to_string()
})
.collect();
tags.sort();
assert_eq!(tags, vec!["feed_service_now", "usage"]);
}
/// An atom without a nested exclude must not emit an `exclude` key (no
/// spurious empty `exclude: []`).
#[test]
fn test_serialize_atom_without_exclude() {View on GitHub (pinned to 0267ce9170)