MetricSign
EN|NLRequest Access
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

  1. 1Step 1: Run dbt list --select your_model_name to confirm dbt can resolve the model.
  2. 2Step 2: Check the models/ directory for the .sql file: find . -name 'your_model_name.sql'.
  3. 3Step 3: If the file was renamed, update all ref('old_name') references to ref('new_name') across the project.
  4. 4Step 4: If the file was deleted accidentally, restore it from version control: git checkout HEAD -- models/path/your_model.sql.
  5. 5Step 5: Run dbt parse to validate the full project graph before triggering a production run.

Frequently asked questions

Can dbt run successfully if a model is in YAML but has no SQL file?

No — dbt requires a matching .sql file for every model node in the graph. Models defined only in YAML without a SQL file will cause a compile error. The exception is dbt model contracts that reference external tables via sources.

How do I safely rename a dbt model without breaking downstream refs?

Use the deprecation workflow: create the new model file, add a deprecate config to the old model that redirects users, update all downstream refs to the new name, then delete the old file in a follow-up PR.

Other compilation errors