<@U088WCP3B4P>, is there any update from the last ...
# ask-elementary-ai
k
@kapa.ai, is there any update from the last 2 days? I have this error with dbt without any change in the code
Copy code
dbt1501: Failed to render SQL undefined value
                        (in dbt_packages/elementary/dbt_project.yml:25:1)
                        (in dbt_packages/elementary/macros/edr/system/hooks/on_run_end.sql:25:25)
                        (in dbt_packages/elementary/macros/edr/dbt_artifacts/upload_source_freshness.sql:5:59)
                        (in dbt_packages/elementary/macros/edr/dbt_artifacts/upload_source_freshness.sql:20:29)
                          --> dbt_packages/elementary/dbt_project.yml:25:1
k
The error you're seeing (
dbt1501: Failed to render SQL undefined value
) in
upload_source_freshness.sql
and
on_run_end.sql
is related to a known compatibility issue between Elementary and dbt versions, particularly around how source freshness hooks are handled. Here's what the knowledge sources indicate may be relevant to your situation: Likely Cause: source_freshness_run_project_hooks flag Starting with dbt Core 1.10.0, the default value of the
source_freshness_run_project_hooks
flag changed to
true
. This means that when you run
dbt source freshness
, the
on-run-end
hook is now triggered automatically — which can cause conflicts if you're also uploading source freshness results manually via
edr run-operation
. [source freshness hooks] As a workaround, you can explicitly set the flag to
false
in your
dbt_project.yml
until the issue is resolved:
Copy code
flags:
  source_freshness_run_project_hooks: false
Other Possible Causes 1. Version incompatibility: The
to_dict
/
undefined value
type errors in Elementary's macros are typically caused by breaking changes in dbt's internal APIs that Elementary hasn't yet caught up with. Upgrading Elementary and running the following commands has resolved similar issues for other users: [dbt compile issue]
Copy code
dbt deps
dbt run --select elementary
2. dbt Fusion compatibility: If you're using dbt Fusion, there is a known issue where
on-run-end
hooks need to return valid SQL. This was reported as being fixed in a canary release: [dbt Fusion issue]
Copy code
dbtf system update --version canary
Since you mentioned "no change in the code," the most likely culprit is a dbt version update (especially if you recently moved to dbt Core 1.10.0+) that changed the default behavior of
source_freshness_run_project_hooks
. Setting that flag to
false
or upgrading Elementary to the latest version would be the recommended first steps. If none of these resolve the issue, I'd recommend sharing your
dbt.log
and
edr.log
with the Elementary support team for deeper investigation. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @elementary.ai in the thread for follow-ups or DM the app for 1-to-1 help.
k
@kapa.ai I've migrated to dbt fusion engine. dbt has removed this flag :
Copy code
WARN         Warn dbt1005: Behavior flag 'require_generic_test_arguments_property' has been removed in dbt Fusion. This flag can be safely removed from your dbt_project.yml.
09:00:17
    WARN         Warn dbt1005: Behavior flag 'source_freshness_run_project_hooks' has been removed in dbt Fusion. This flag can be safely removed from your dbt_project.yml.
k
Thanks for the update! This is useful context. Since you've migrated to dbt Fusion, here's what the knowledge sources say: dbt Fusion and Source Freshness In dbt Fusion, the
source_freshness_run_project_hooks
flag has been removed (as your warning confirms). This means you can safely remove it from your
dbt_project.yml
. [dbt Fusion integration] Known Issue: on-run-end Hook in dbt Fusion There is a known issue with Elementary's
on-run-end
hooks in dbt Fusion. When just compiling, the hook generates empty SQL, which causes a failure in BigQuery (and potentially other adapters). The reported error looks like:
Copy code
dbt1501: Failed to render SQL invalid operation: AdapterError
A community member identified that the fix was to upgrade to the canary release of dbt Fusion: [dbt Fusion hook issue]
Copy code
dbtf system update --version canary
This was confirmed to be fixed in the next Fusion release via the dbt-fusion GitHub issue #797. Summary • Safely remove
source_freshness_run_project_hooks
and
require_generic_test_arguments_property
from your
dbt_project.yml
— they are no longer needed in Fusion. • If you're still seeing the
on-run-end
SQL rendering error, try upgrading to the dbt Fusion canary release. • Note that Elementary's dbt Fusion support is still in beta, so some edge cases may not yet be fully resolved. [dbt Fusion beta] If the issue persists after upgrading Fusion, I'd recommend reaching out to the Elementary team directly for further support. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @elementary.ai in the thread for follow-ups or DM the app for 1-to-1 help.