dbt-labs/dbt-core · error

inline exclude should remain a list inside union

Error message

inline exclude should remain a list inside union

What it means

Test-only assertion in the #10393 regression test: the inline exclude inside the union must remain a list entry within the union sequence (union length 3: a, b, exclude). Fires if the exclude is hoisted out of the union or collapsed.

Solutions

  1. Preserve the original union/exclude nesting when writing manifest definitions
  2. Verify the union element count and ordering in serialization
  3. Treat failure as a manifest shape regression
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:725 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/e77bce71768ebbda. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-parser/src/resolve/resolve_selectors.rs:725

            .expect("selector definition should be present");

        assert!(
            definition.get("intersection").is_none(),
            "manifest must not serialize normalized runtime And as intersection"
        );
        let union = definition
            .get("union")
            .and_then(|value| value.as_sequence())
            .expect("manifest should preserve original union");
        assert_eq!(union.len(), 3);
        assert_eq!(union[0].get("method").and_then(|v| v.as_str()), Some("fqn"));
        assert_eq!(union[0].get("value").and_then(|v| v.as_str()), Some("a"));
        assert_eq!(union[1].get("method").and_then(|v| v.as_str()), Some("fqn"));
        assert_eq!(union[1].get("value").and_then(|v| v.as_str()), Some("b"));
        let exclude = union[2]
            .get("exclude")
            .and_then(|value| value.as_sequence())
            .expect("inline exclude should remain a list inside union");
        assert_eq!(exclude.len(), 1);
        assert_eq!(
            exclude[0].get("method").and_then(|v| v.as_str()),
            Some("fqn")
        );
        assert_eq!(exclude[0].get("value").and_then(|v| v.as_str()), Some("c"));
        Ok(())
    }

    #[test]
    fn test_manifest_selector_preserves_dot_notation_method() -> FsResult<()> {
        let original_definition =
            SelectorDefinitionValue::Full(SelectorExpr::Atom(AtomExpr::Method(MethodAtomExpr {
                method: "config.materialized".to_string(),
                value: SelectorValue::from("table").into(),
                childrens_parents: SelectorDefaultSpec::from(false),
                parents: SelectorDefaultSpec::from(false),
                children: SelectorDefaultSpec::from(false),

View on GitHub (pinned to 0267ce9170)