dbt-labs/dbt-core · error

Failed to deserialize RedshiftMaterializedViewConfig

Error message

Failed to deserialize RedshiftMaterializedViewConfig: {e}

What it means

After confirming the model is a materialized view, converting its node into RedshiftMaterializedViewConfig failed — required Redshift-specific fields (autorefresh, backup, dist/distkey, sort keys, etc.) are missing from the model config or have the wrong types, so the serde conversion errors out.

Solutions

  1. Fill in the required Redshift materialized-view config fields on the model
  2. Check field types in the model config YAML against the expected schema
  3. Add serde defaults or per-field error detail to pinpoint the bad key
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

            return Err(minijinja::Error::new(
                minijinja::ErrorKind::InvalidOperation,
                "Expected a model node",
            ));
        }
    };

    if model.__base_attr__.materialized != DbtMaterialization::MaterializedView {
        return Err(minijinja::Error::new(
            minijinja::ErrorKind::InvalidOperation,
            format!(
                "Unsupported operation for materialization type {}",
                &model.__base_attr__.materialized
            ),
        ));
    }

    RedshiftMaterializedViewConfig::try_from(&*model).map_err(|e| {
        minijinja::Error::new(
            minijinja::ErrorKind::SerdeDeserializeError,
            format!("Failed to deserialize RedshiftMaterializedViewConfig: {e}"),
        )
    })
}

#[cfg(test)]
mod tests {
    use super::*;
    use dbt_schemas::{dbt_types::RelationType, schemas::relations::DEFAULT_RESOLVED_QUOTING};

    mod postgres {
        use super::*;

        #[test]
        fn test_try_new_via_static_base_relation() {
            let relation_type = RelationStatic {
                adapter_type: AdapterType::Postgres,

View on GitHub (pinned to 0267ce9170)