dbt-labs/dbt-core · error
remote_state cannot be None
Error message
remote_state cannot be None
What it means
In the BigQuery branch of the changeset code, `remote_state_value` must be present; if it is None the code raises this InvalidArgument error instead of proceeding. The BigQuery path has no way to compute a changeset without the current remote state of the table/view.
Source
Thrown at crates/dbt-adapter/src/relation/relation_impl.rs:1276
"materialized_view_config_changeset: Failed to deserialize RedshiftMaterializedViewConfig: {e}"
),
)
})?;
let local_config = node_value_to_redshift_materialized_view(local_config_value)?;
let changeset =
RedshiftMaterializedViewConfigChangeset::new(remote_state, local_config);
if changeset.has_changes() {
Ok(Value::from_object(changeset))
} else {
Ok(Value::from(None::<()>))
}
}
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",
)View on GitHub (pinned to 0267ce9170)
Solutions
- Fetch and pass the remote state (e.g. results of describing the BigQuery table/view) before computing the changeset.
- Handle upstream describe failures so None never propagates into this call.
- Skip changeset computation for create-on-first-run cases instead of passing None.
Example fix
-- before
{{ relation.changeset(remote_state=None) }}
-- after
{% set results = api.Relation.get_remote_state(relation) %}
{{ relation.changeset(remote_state=results) }} Defensive patterns
Strategy: validation
Validate before calling
{% if remote_state is none %}
{{ exceptions.raise_compiler_error('BigQuery changeset requires remote_state; fetch it first') }}
{% endif %} Type guard
let has_state = remote_state_value.is_some();
Try / catch
try:
changeset = relation.changeset(remote_state=remote_state)
except minijinja.Error as e:
if 'remote_state cannot be None' in str(e):
remote_state = fetch_remote_state(relation)
changeset = relation.changeset(remote_state=remote_state)
else:
raise Prevention
- Always run the describe step before computing changesets
- Propagate describe failures instead of defaulting state to None
- Treat first-run/create cases as full builds, not changesets
When it happens
Trigger: Calling the changeset function for a BigQuery relation with remote_state=None (e.g. describe results were not fetched or were discarded).
Common situations: Macros skipping the remote-state fetch on error, first-run flows passing nothing as state, or code paths that default state to None.
Related errors
- remote_state must be Object
- In adapter.dispatch, got a macro name of "{macro_name}", but
- get_csv_data: argument must be an AgateTable
- 'materialized_view_from_relation_config' can only be invoked
- get_table_options: Failed to deserialize InternalDbtNodeWrap
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/b3fdcce0e073f4d2.
Report an issue: GitHub.