dbt-labs/dbt-core · error

selector definition should be present

Error message

selector definition should be present

What it means

Test-only assertion in the #10393 regression test: after resolving manifest selectors, the all_except_c entry must retain its definition. Fires only if manifest selector resolution drops definitions along the way.

Solutions

  1. Fix resolve_manifest_selectors to carry definitions through unchanged
  2. Check the SelectorEntry construction path for dropped fields
  3. Treat failure as a manifest serialization regression
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        .expect("issue #10393 selector YAML should parse");
        let original_definition = selector_file.selectors[0].definition.clone();
        let normalized_include =
            SelectorParser::new(BTreeMap::new()).parse_definition(&original_definition)?;
        let resolved_selectors = HashMap::from([(
            "all_except_c".to_string(),
            SelectorEntry {
                include: normalized_include,
                is_default: false,
                description: Some("Union of a and b, excluding c".to_string()),
                definition: original_definition,
            },
        )]);

        let manifest_selectors = resolve_manifest_selectors(resolved_selectors)?;
        let definition = manifest_selectors
            .get("all_except_c")
            .and_then(|selector| selector.definition.as_ref())
            .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");

View on GitHub (pinned to 0267ce9170)