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

{e}

Error message

{e}

What it means

Inside describe_dynamic_table, after querying the dynamic table a synthetic `transient` boolean column is appended to the Arrow RecordBatch. If RecordBatch::try_new rejects the new schema/columns (e.g. length mismatch or type mismatch), the underlying error message is wrapped as a minijinja InvalidOperation error. This is an internal invariant failure during result construction, not a database problem.

Source

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

                            .map(|col| col.value(0).eq_ignore_ascii_case("TRANSIENT"))
                            .unwrap_or(false)
                    } else {
                        false
                    };

                    // Fold the transient column into the SHOW DYNAMIC TABLES result
                    let record_batch = table.to_record_batch();
                    let num_rows = record_batch.num_rows();
                    let transient_col: ArrayRef =
                        Arc::new(BooleanArray::from(vec![Some(is_transient); num_rows]));
                    let mut fields: Vec<Arc<Field>> =
                        record_batch.schema().fields().iter().cloned().collect();
                    fields.push(Arc::new(Field::new("transient", DataType::Boolean, true)));
                    let new_schema = Arc::new(Schema::new(fields));
                    let mut columns = record_batch.columns().to_vec();
                    columns.push(transient_col);
                    let new_batch = RecordBatch::try_new(new_schema, columns).map_err(|e| {
                        minijinja::Error::new(minijinja::ErrorKind::InvalidOperation, e.to_string())
                    })?;
                    AgateTable::from_record_batch(Arc::new(new_batch))
                } else {
                    table
                };

                Ok(Value::from(ValueMap::from([(
                    Value::from("dynamic_table"),
                    Value::from_object(table),
                )])))
            }
            Postgres | Bigquery | Databricks | Redshift | Salesforce | Spark | DuckDB
            | LakeCompute | Fabric | ClickHouse | Exasol | Starburst | Athena | Trino
            | Datafusion | Dremio | Oracle => {
                let err = format!(
                    "describe_dynamic_table is not supported by the {} adapter",
                    adapter_type
                );

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Read the wrapped message ({e}) to see the exact Arrow schema error, usually a column length or type mismatch.
  2. Verify the adapter's describe query returns the columns the code expects before the transient column is appended.
  3. Update or pin the Arrow/driver versions if a driver upgrade changed result schemas.
  4. If reproducible, file/inspect the RecordBatch construction path in adapter_impl.rs describe_dynamic_table.
Defensive patterns

Strategy: try-catch

Try / catch

match describe_relation(relation) {
    Err(e) if e.to_string().contains("RecordBatch") || e.kind() == minijinja::ErrorKind::InvalidOperation => {
        log::warn!("describe_dynamic_table result construction failed: {e}");
        fallback_metadata(relation)
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling describe_relation → describe_dynamic_table on an adapter whose query returns a batch whose column count/length disagrees with the schema when the transient column is appended — e.g. a zero-row or schema-drifted result from a custom/modified relation query.

Common situations: Adapter results whose Arrow schema was altered by a driver update; patched or overridden describe queries returning different column ordering/counts; empty result sets where batch reconstruction fails.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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