David Shi
06/25/2025, 8:46 PMedr run-operation upload-source-freshness \
--project-dir . \
--profile-target e2_prod
________ __
/ ____/ /__ ____ ___ ___ ____ / /_____ ________ __
/ __/ / / _ \/ __ `__ \/ _ \/ __ \/ __/ __ `/ ___/ / / /
/ /___/ / __/ / / / / / __/ / / / /_/ /_/ / / / /_/ /
/_____/_/\___/_/ /_/ /_/\___/_/ /_/\__/\__,_/_/ \__, /
/____/
Any feedback and suggestions are welcomed! join our community here - <https://bit.ly/slack-elementary>
2025-06-25 15:57:21 — INFO — Running with edr=0.19.0
INFO:elementary.cli.cli:Running with edr=0.19.0
DEBUG:elementary.clients.dbt.command_line_dbt_runner:Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.can_upload_source_freshness", "macro_args": {"invocation_id": "4f5676e9-d7d8-4f67-b1ad-71e4d155acf5"}} --project-dir /Users/david.shi/Library/Caches/pypoetry/virtualenvs/dippr-grznMPux-py3.12/lib/python3.12/site-packages/elementary/monitor/dbt_project --target e2_prod
WARNING:thrift.transport.sslcompat:using legacy validation callback
/Users/david.shi/Library/Caches/pypoetry/virtualenvs/dippr-grznMPux-py3.12/lib/python3.12/site-packages/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
* 'allow_population_by_field_name' has been renamed to 'populate_by_name'
warnings.warn(message, UserWarning)
Error: Source freshness for invocation id 4f5676e9-d7d8-4f67-b1ad-71e4d155acf5 were already uploaded.kapa.ai
06/25/2025, 8:46 PMkapa.ai
06/25/2025, 8:46 PMError: Source freshness for invocation id 4f5676e9-d7d8-4f67-b1ad-71e4d155acf5 were already uploaded. This indicates that Elementary is detecting the source freshness results for this specific invocation ID have already been uploaded. This is a new behavior in recent versions of Elementary, where duplicate uploads for the same invocation are prevented. What could be happening: - The edr run-operation upload-source-freshness command is being run more than once with the same invocation ID (which is typically tied to the dbt run or the freshness run). - The sources.json file generated by dbt source freshness is not being regenerated between runs, so the same invocation ID is reused. - There may be a change in how Elementary tracks or checks for previously uploaded freshness results in version 0.19.0 compared to 0.15.0. What to check and try: 1. Ensure dbt source freshness is run immediately before edr run-operation upload-source-freshness in the same Airflow task, and that it generates a new sources.json file each time. 2. Check for task retries or duplicate executions in Airflow that might cause the upload to be attempted multiple times with the same artifacts. 3. Clear or regenerate the target/ directory (where sources.json is stored) before running dbt source freshness to ensure no stale files are present. 4. Review Airflow logs to confirm that the sequence of commands is as expected and that no previous upload for the same invocation is happening. Unfortunately, the knowledge sources do not contain explicit documentation about this specific error message or changes in invocation ID handling between versions 0.15.0 and 0.19.0. However, similar issues with source freshness uploads and artifact handling have been discussed, especially around ensuring the correct sequence of commands and artifact freshness[Slack thread on source freshness issues](https://slack.com/archives/C02CTC89LAX/p1694700068197439). If after these checks the issue persists, it may be worth reaching out to the Elementary community or support, as this could be a new or edge-case behavior introduced in the latest version. Be sure to provide your Airflow DAG/task sequence and any relevant logs for further troubleshooting.David Shi
06/26/2025, 3:28 PMkapa.ai
06/26/2025, 3:28 PMkapa.ai
06/26/2025, 3:28 PMDavid Shi
06/26/2025, 8:32 PMkapa.ai
06/26/2025, 8:32 PMkapa.ai
06/26/2025, 8:32 PMelementary.dbt_source_freshness_results table, nor do they recommend periodic cleanup of this table to prevent such collisions. Invocation IDs are intended to be unique per dbt/Elementary run, and collisions should not occur under normal operation. However, there is user interest in retention and pruning of these results for storage management reasons. One user asked about configuring retention or pruning for the *_results tables (including dbt_source_freshness_results), but there was no official answer or recommendation provided in the sources about periodic cleanup or its impact on invocation_id uniqueness or collisions. The only mention was a user speculating about the --days-back argument, but this was not confirmed as a solution for retention or collision prevention [Slack thread on retention/pruning](https://slack.com/archives/C02CTC89LAX/p1728558831092529). In summary: There is no official guidance in the knowledge sources recommending periodic cleanup of the dbt_source_freshness_results table to minimize invocation_id collisions. If you are concerned about storage or retention, you may consider your own data retention policies, but this is not documented as a method to prevent invocation_id issues. If invocation_id collisions are occurring, it may indicate a different underlying issue with how invocation IDs are generated or reused.David Shi
06/26/2025, 8:39 PMDavid Shi
06/26/2025, 8:40 PMdbt_upload_source_freshness_check = BashOperator(
task_id="dbt_source_freshness",
bash_command=(
f"{DBT_INITIAL_CMD} && "
f"dbt --no-use-colors source freshness --exclude tag:disabled " # noqa: E231
f"--profiles-dir {DBT_PROFILE_DIR} "
f"--profile {DBT_PROFILE} "
f"--target {DBT_PROD_TARGET} && "
f"ret=$? && "
f"edr run-operation upload-source-freshness "
f"--profiles-dir {DBT_PROFILE_DIR} "
f"--project-dir {DBT_PROFILE_DIR}{DBT_E2_CODE_BASE} "
f"--profile-target {DBT_PROD_TARGET} && "
f"ret=$? && exit $ret"
),
retries=1,
on_failure_callback=generic_task_error_callback,
executor_config=k8s_dbt_executor_config,
)kapa.ai
06/26/2025, 8:40 PMkapa.ai
06/26/2025, 8:40 PMdbt source freshness 2. Immediately run edr run-operation upload-source-freshness in the same BashOperator/task This matches guidance from Elementary support, who have emphasized that both commands should be run in the same task or operator to ensure the sources.json file is fresh and available for upload, and to avoid issues with missing or stale artifacts [Slack thread on Airflow and source freshness](https://slack.com/archives/C02CTC89LAX/p1691513076109829) [Another thread on Airflow task sequence](https://slack.com/archives/C02CTC89LAX/p1697013303000359). A few things to double-check based on common issues: - Ensure that the --project-dir and --profiles-dir arguments are pointing to the correct locations for both dbt and edr commands. Mismatches here have caused issues for other users. - Confirm that the sources.json file is being generated in the expected location and is accessible to the edr command. - Make sure there are no task retries or duplicate executions that could cause the same invocation ID to be uploaded more than once, as this is a new check in recent Elementary versions. Otherwise, nothing in your command sequence stands out as incorrect based on the available knowledge sources. If you are still encountering the "already uploaded" error, it may be related to how invocation IDs are handled or reused, which is not fully documented in the sources. If the issue persists, consider sharing more detailed logs or reaching out to the Elementary community for further troubleshooting.George Tzanakis
07/04/2025, 7:20 AMDavid Shi
07/04/2025, 1:35 PMsource_freshness_run_project_hooks: False in our dbt_project.yml. The edr source upload is run automatically after dbt 1.10 as a post run hook, so we were uploading the same results a second time with the same invocation_id which resulted in this error. Hopefully this helps you resolve your issue as well
here's the continued thread for context:
https://elementary-community.slack.com/archives/C02CTC89LAX/p1751464750864769?thread_ts=1750885014.366019&cid=C02CTC89LAXGeorge Tzanakis
07/04/2025, 2:23 PM