dbt-labs/dbt-core · error

remote_state must be RelationConfig

Error message

remote_state must be RelationConfig

What it means

The remote_state argument passed to a config-changeset path is not a RelationConfig object — the downcast to the expected wrapper failed, so current-vs-desired state comparison cannot proceed. Distinct from the earlier 'remote_state cannot be None' check: here a value exists but has the wrong type.

Solutions

  1. Pass the RelationConfig produced by the adapter's describe/get_relation path
  2. Don't substitute plain dicts or unrelated objects for remote_state
  3. Type-check remote_state before invoking the changeset logic
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/dbt-adapter/src/relation/relation_impl.rs:1291 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/23d5bbbba1add9bd. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-adapter/src/relation/relation_impl.rs:1291

            }
            Bigquery => {
                if remote_state_value.is_none() {
                    return Err(minijinja::Error::new(
                        minijinja::ErrorKind::InvalidArgument,
                        "remote_state cannot be None",
                    ));
                }
                let current_state = remote_state_value
                    .as_object()
                    .ok_or_else(|| {
                        minijinja::Error::new(
                            minijinja::ErrorKind::InvalidArgument,
                            "remote_state must be Object",
                        )
                    })?
                    .downcast_ref::<RelationConfig>()
                    .ok_or_else(|| {
                        minijinja::Error::new(
                            minijinja::ErrorKind::InvalidArgument,
                            "remote_state must be RelationConfig",
                        )
                    })?;

                // TODO(serramatutu): minijinja_value_to_typed_struct does not work with
                // references, so we have to clone the value here...
                let local_config = minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(
                    local_config_value.clone(),
                )
                .map_err(|e| {
                    minijinja::Error::new(
                        minijinja::ErrorKind::SerdeDeserializeError,
                        format!("Failed to deserialize InternalDbtNodeWrapper: {e}"),
                    )
                })?;
                let local_config = match local_config {
                    InternalDbtNodeWrapper::Model(model) => model,

View on GitHub (pinned to 0267ce9170)