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

  1. 1Run `dbt compile` locally to reproduce the error and see the full stack trace.
  2. 2Check the model name in the ref() call — it must exactly match the filename (without .sql) of the model in your project.
  3. 3Verify that any source() calls match a defined source in a schema.yml file.
  4. 4If using Jinja macros, confirm the macro is defined in the macros/ directory and accepts the arguments you are passing.
  5. 5Run `dbt ls` to see all resolvable models — any compilation failure will surface as an error in the list.
  6. 6Check for circular dependencies using `dbt ls --select +<model_name>` to trace the lineage.

Frequently asked questions

Does a compilation error run any SQL against the database?

No — compilation happens entirely in memory before any SQL reaches the warehouse. Your data is unaffected, but all downstream models that depend on the failed model also skip.

Can I fix a compilation error without rerunning the full job?

Yes — once you fix the error, rerun only the affected model and its dependents using `dbt run --select <model_name>+`.

Why does my compilation error only appear in dbt Cloud and not locally?

Environment variables, profiles, and installed packages may differ between local and Cloud. Check that the Cloud job's env vars and dbt_project.yml vars match your local setup.

Official documentation: https://docs.getdbt.com/guides/debug-errors

Other dbt errors