MetricSign
EN|NLRequest Access
High severityconfiguration

Power BI Refresh Error:
ColumnTypeMismatch

What does this error mean?

dbt's model contract enforcement found that a column's actual data type in the warehouse does not match the declared type in the model's YAML contract. This error enforces strict schema governance — models with contracts must produce exactly the declared columns and types or the run fails.

Common causes

  • 1A model's SQL was changed to cast a column differently than the declared contract type (e.g., the contract says `bigint` but the column is now `varchar`)
  • 2The upstream source changed the type of a column that is passed through to the contracted model without an explicit CAST
  • 3Different warehouses represent the same logical type differently (e.g., `int` vs `integer` vs `int4`) causing false mismatches
  • 4A dbt version upgrade changed how adapter type names are normalised in contract checks
  • 5The contract was defined with a warehouse-specific type alias that is not recognised by the current adapter plugin

How to fix it

  1. 1Run `dbt run --select <model>` and check the error output — it will name the column and show the expected vs actual type.
  2. 2Add an explicit CAST in the model SQL to coerce the column to the declared contract type: `CAST(<column> AS <declared_type>) AS <column_name>`.
  3. 3Review the contract definition in the model's YAML and ensure the declared `data_type` matches the canonical type name for your adapter.
  4. 4If the type difference is nominal (e.g., `int` vs `integer`), use the full canonical type name that the adapter uses in its type mapping.
  5. 5Run `dbt debug --connection` and inspect the adapter's type map to find the correct canonical type name for your warehouse.

Frequently asked questions

Do dbt model contracts enforce column types at the database level?

No — dbt contracts are validated at run time by dbt, not enforced as database constraints. Dbt checks the actual column type returned by the warehouse against the declared type and fails the run if they differ.

How do I find the exact type name my warehouse uses for a column?

Run `dbt show --select <model> --limit 1` or query `information_schema.columns` directly. The type name shown there is the canonical name to use in the contract.

Other configuration errors