High severitydbt
Power BI Refresh Error:
Compilation Error: Invalid Jinja
What does this error mean?
Dbt encountered a Jinja templating error during compilation. An unclosed block, undefined variable, or incorrect macro call prevented the model from rendering.
Common causes
- 1Unclosed Jinja blocks such as {% if %} without a corresponding {% endif %}
- 2A variable referenced with {{ var() }} is not defined in dbt_project.yml or --vars
- 3A macro is called with incorrect argument names or is not defined in the macros/ directory
How to fix it
- 1Run `dbt compile` locally to see the exact file and line number of the Jinja error.
- 2Check for unclosed {% %} blocks or mismatched {{ }} delimiters.
- 3Verify that all variables referenced with {{ var() }} are defined in dbt_project.yml or passed via --vars.
- 4If calling a macro, confirm it is defined in the macros/ directory and arguments are correct.
Frequently asked questions
Official documentation: https://docs.getdbt.com/guides/debug-errors