dbt-labs/dbt-core · error · minijinja::Error::InvalidOperation

get_common_options is only available with BigQuery adapter

Error message

get_common_options is only available with BigQuery adapter

What it means

get_common_options builds adapter-specific common options (e.g. BigQuery job labels/cost caps) but is only implemented for the BigQuery adapter. For Postgres, Snowflake, Databricks, Redshift, Spark, DuckDB, and all other listed adapter types it throws an InvalidOperation error stating the API is BigQuery-only.

Solutions

  1. Guard the call with an adapter-type check and only call get_common_options under BigQuery.
  2. For other adapters, use their native options APIs or omit the common-options step.
  3. If you need cross-adapter behavior, implement a dispatch: call get_common_options only when adapter_type() == BigQuery, else return a default Value.
  4. Refactor shared materializations so BigQuery-specific option handling is isolated.

Example fix

// before
options = adapter.get_common_options(temporary)

// after
if adapter.type() == 'bigquery':
    options = adapter.get_common_options(temporary)
else:
    options = {}
Defensive patterns

Strategy: type-guard

Validate before calling

def supports_common_options(adapter_type):
    return adapter_type == 'bigquery'

Type guard

def is_bigquery(adapter_type):
    return adapter_type == 'bigquery'

Try / catch

try:
    options = adapter.get_common_options(temporary)
except Exception as e:
    if 'only available with BigQuery' in str(e):
        options = {}
    else:
        raise

Prevention

When it happens

Trigger: Calling get_common_options from a macro or materialization while self.adapter_type() is anything other than BigQuery (Postgres, Snowflake, Databricks, Redshift, Salesforce, Spark, DuckDB, LakeCompute, Fabric, ClickHouse, Exasol, Starburst, Athena, Trino, Datafusion, Dremio, Oracle).

Common situations: Reusing a BigQuery-targeted macro across projects with different adapters; copy-pasted custom materializations; running a BigQuery-specific model on another warehouse during migration.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/faef8ceeb4ec4bb3. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-adapter/src/adapter/adapter_impl.rs:3957

        state: &State,
        config: ModelConfig,
        node: &InternalDbtNodeWrapper,
        temporary: bool,
    ) -> Result<Value, minijinja::Error> {
        match self.adapter_type() {
            Bigquery => {
                let node = node.as_internal_node();
                let options = metadata::bigquery::object_options::get_common_table_options_value(
                    state,
                    config,
                    node.common(),
                    temporary,
                );
                Ok(Value::from_serialize(options))
            }
            Postgres | Snowflake | Databricks | Redshift | Salesforce | Spark | DuckDB
            | LakeCompute | Fabric | ClickHouse | Exasol | Starburst | Athena | Trino
            | Datafusion | Dremio | Oracle => Err(minijinja::Error::new(
                minijinja::ErrorKind::InvalidOperation,
                "get_common_options is only available with BigQuery adapter",
            )),
        }
    }

    /// Add time ingestion partition column to columns list
    ///
    /// BigQueryAdapter https://github.com/dbt-labs/dbt-adapters/blob/0efd8d3d1081e1ab43e38797d5104f7b424a6284/dbt-bigquery/src/dbt/adapters/bigquery/impl.py#L342
    pub fn add_time_ingestion_partition_column(
        &self,
        columns: Value,
        partition_config: BigqueryPartitionConfig,
    ) -> AdapterResult<Value> {
        match self.adapter_type() {
            Bigquery => {
                let mut result = Column::vec_from_jinja_value(Bigquery, columns.clone())?;

View on GitHub (pinned to 0267ce9170)