High severitydbt
Power BI Refresh Error:
Compilation Error
What does this error mean?
Dbt failed to compile one or more models before execution began. The Jinja templating or SQL could not be rendered into valid SQL, preventing any models from running. This is a pre-execution failure — no database operations were attempted.
Common causes
- 1A ref() or source() call points to a model or source that does not exist in the project
- 2A Jinja variable or macro is undefined or called with incorrect arguments
- 3Circular references between models (model A refs model B which refs model A)
- 4Malformed Jinja syntax such as unclosed blocks or incorrect delimiters
- 5A required variable passed with --vars is missing or has an unexpected type
How to fix it
- 1Run `dbt compile` locally to reproduce the error and see the full stack trace.
- 2Check the model name in the ref() call — it must exactly match the filename (without .sql) of the model in your project.
- 3Verify that any source() calls match a defined source in a schema.yml file.
- 4If using Jinja macros, confirm the macro is defined in the macros/ directory and accepts the arguments you are passing.
- 5Run `dbt ls` to see all resolvable models — any compilation failure will surface as an error in the list.
- 6Check for circular dependencies using `dbt ls --select +<model_name>` to trace the lineage.
Frequently asked questions
Official documentation: https://docs.getdbt.com/guides/debug-errors