High severitycompilation
Power BI Refresh Error:
CompilationError
What does this error mean?
dbt compilation failed because a model is declared in schema.yml or referenced by another model but its corresponding .sql file does not exist in the models directory.
Common causes
- 1A model was defined in schema.yml but the SQL file was never created or was accidentally deleted
- 2A model file was renamed in the file system but the YAML reference still uses the old name
- 3A dbt package or project was referenced with a model name that does not exist in that package's version
- 4A Git merge conflict left an inconsistent state where the YAML was merged but the SQL file was not
How to fix it
- 1Step 1: Run dbt list --select your_model_name to confirm dbt can resolve the model.
- 2Step 2: Check the models/ directory for the .sql file: find . -name 'your_model_name.sql'.
- 3Step 3: If the file was renamed, update all ref('old_name') references to ref('new_name') across the project.
- 4Step 4: If the file was deleted accidentally, restore it from version control: git checkout HEAD -- models/path/your_model.sql.
- 5Step 5: Run dbt parse to validate the full project graph before triggering a production run.