MetricSign
EN|NLRequest Access
High severitycompilation

Power BI Refresh Error:
ModelVersionLatestNotFound

What does this error mean?

dbt could not resolve a ref() call to a versioned model because the model's latest_version configuration points to a version that does not exist in the project, causing compilation to fail.

Common causes

  • 1A versioned model's latest_version property was manually set to a version number that was later deleted or renamed
  • 2A model file was renamed without updating the versions block and latest_version in the model's YAML definition
  • 3A new version was added to the model's YAML but the corresponding model SQL file was not created

How to fix it

  1. 1Step 1: Inspect the model's YAML definition and confirm that all version numbers listed in the versions block have a corresponding SQL file (e.g., my_model_v1.sql, my_model_v2.sql).
  2. 2Step 2: Update the latest_version property to match the highest existing version: latest_version: 2 (or remove it to let dbt auto-detect the highest version).
  3. 3Step 3: Run dbt compile to verify that all ref() calls to the model resolve correctly after the fix.
  4. 4Step 4: Check for any ref('my_model', version=<n>) calls in downstream models that may reference the missing version and update them.

Frequently asked questions

What happens if latest_version is not set at all?

If latest_version is omitted, dbt automatically uses the highest version number found in the versions block as the latest. This is the recommended approach unless you need to explicitly pin the latest to an older version.

Can downstream models ref a specific version?

Yes. Use ref('my_model', version=1) to pin to a specific version. Without the version argument, dbt resolves the ref to whatever is configured as latest_version.

Other compilation errors