dbt-labs/dbt-core · error

a desired component with no current state must produce a…

Error message

a desired component with no current state must produce a change

What it means

Test-only invariant expect in complete_changeset: when completing a changeset, a desired component that exists with no prior change entry must produce a newly created change; unwrap on that path failed. Fires only if the change-production logic in config_v2 relation diffing regresses.

Solutions

  1. Debug why the desired-component branch returned None instead of a created change
  2. Re-run the config_v2 diff tests to isolate which component type fails
  3. Treat as a regression in complete_changeset, not a user-facing error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-adapter/src/relation/config_v2.rs:326 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/e40f119b16745c07. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-adapter/src/relation/config_v2.rs:326

        mut changes: IndexMap<&'static str, ComponentConfigChange>,
    ) -> IndexMap<&'static str, ComponentConfigChange> {
        let Some(changeset_key) = self.complete_changeset_key_fn else {
            return changes;
        };
        if changes.is_empty() {
            return changes;
        }

        let mut complete = IndexMap::new();
        for (type_name, desired_component) in &self.components {
            let Some(key) = changeset_key(type_name) else {
                continue;
            };
            let change = changes.shift_remove(type_name).unwrap_or_else(|| {
                ComponentConfigChange::Some(
                    desired_component
                        .diff_from(None)
                        .expect("a desired component with no current state must produce a change"),
                )
            });
            complete.insert(key, change);
        }
        complete.extend(changes);
        complete
    }

    fn sparse_diff(
        &self,
        current_state: &RelationConfig,
    ) -> IndexMap<&'static str, ComponentConfigChange> {
        let changed = self.components.iter().filter_map(|(type_name, desired)| {
            desired
                .diff_from(current_state.get(type_name))
                .map(|diff| (*type_name, ComponentConfigChange::Some(diff)))
        });
        let dropped = current_state

View on GitHub (pinned to 0267ce9170)