Medium severityconfiguration
Power BI Refresh Error:
HookRunError (on-run-end)
What does this error mean?
A SQL statement or macro defined in the on-run-end hook in dbt_project.yml failed to execute. dbt runs on-run-end hooks after all selected nodes complete, so a hook failure is reported even when all models succeeded.
Common causes
- 1A SQL statement in on-run-end references a table or view that does not exist in the current target schema
- 2A macro called from on-run-end raises an exception (e.g. Jinja rendering failure or undefined variable)
- 3The database user running dbt lacks GRANT or DDL permissions required by the hook SQL
- 4The hook SQL is valid in the development target but not in production (different schema names or warehouse settings)
- 5An on-run-end hook calls dbt_utils.grant_select_on_schemas and the schema list is empty or malformed
How to fix it
- 1Run the hook SQL manually in the target database to reproduce and isolate the error.
- 2Check that all object references in the hook SQL use fully qualified names or target-agnostic Jinja variables like {{ target.schema }}.
- 3Verify the dbt runner has the required database permissions for any DDL or GRANT statements in the hook.
- 4Add {{ if execute }} guards if the hook references results() — this prevents the hook from running during dbt compile.
- 5Use dbt debug to validate the connection and environment before re-running the full job.