dbt-labs/dbt-core · error
error while loading local materialized view config: {err}
Error message
error while loading local materialized view config: {err} What it means
After deserializing the internal node, `get_table_options` loads the materialized view relation config through the BigQuery `materialized_view::new_loader()`'s `from_local_config`. If the loaded config is invalid for the materialized-view relation type schema, the loader error is wrapped in this InvalidOperation error.
Source
Thrown at crates/dbt-adapter/src/relation/relation_object.rs:785
let local_config = minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(
local_config_value.clone(),
)
.map_err(|e| {
minijinja::Error::new(
minijinja::ErrorKind::SerdeDeserializeError,
format!(
"get_table_options: Failed to deserialize InternalDbtNodeWrapper: {e}"
),
)
})?;
let loader =
crate::relation::bigquery::config::relation_types::materialized_view::new_loader();
let relation_config = loader
.from_local_config(local_config.as_internal_node())
.map_err(|err| {
minijinja::Error::new(
minijinja::ErrorKind::InvalidOperation,
format!("error while loading local materialized view config: {err}"),
)
})?;
Ok(Value::from_object(relation_config))
}
"get_default_quote_policy" => {
let iter = ArgsIter::new("Relation.get_default_quote_policy", &[], args);
iter.finish()?;
Ok(Value::from_object(QuotePolicyObject(
self.0.get_default_quoting(),
)))
}
_ => Err(minijinja::Error::new(
minijinja::ErrorKind::UnknownMethod,
format!("Unknown method on StaticBaseRelationObject: '{name}'"),
)),
}View on GitHub (pinned to 0267ce9170)
Solutions
- Read the wrapped `err` message to find which config field was rejected and correct it in the model's `config` block.
- Ensure the call targets an actual BigQuery materialized view node, not a table or other relation type.
- Remove or fix unsupported/typo'd materialized-view option keys in the model config.
Example fix
// before
{{ config(materialized='materialized_view', refresh_interval_minutes='30') }}
// after
{{ config(materialized='materialized_view', refresh_interval_minutes=30) }} Defensive patterns
Strategy: validation
Validate before calling
{% if config.get('materialized') != 'materialized_view' %}
{% do exceptions.raise_compiler_error('get_table_options requires a materialized view node') %}
{% endif %} Prevention
- Validate materialized-view option names/types against the BigQuery relation config schema.
- Ensure option value types are correct (numbers as numbers, booleans as booleans).
- Re-run models after upgrading adapters to catch config schema changes.
When it happens
Trigger: Calling `get_table_options` on a BigQuery relation where `from_local_config` rejects the node's config: wrong relation type (table/sequence instead of materialized_view), invalid option keys, or values failing the config schema validation.
Common situations: Materialized view configs with unrecognized or mistyped options (e.g. wrong `enable_refresh`, bad `refresh_interval_minutes` type); calling the method on a node that is not a materialized view; schema drift after a dbt/adapter upgrade.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- when data_type is date, inner must be a TimeConfig
- {}: missing `[project].name`
- adapter.parse_partition_by failed on {raw_partition_by:?}: {
- 'materialized_view_from_relation_config' can only be invoked
- time_partitioning_field must be a string
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/09647969a6251f27.
Report an issue: GitHub.