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
- 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).
- 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).
- 3Step 3: Run dbt compile to verify that all ref() calls to the model resolve correctly after the fix.
- 4Step 4: Check for any ref('my_model', version=<n>) calls in downstream models that may reference the missing version and update them.