You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GitDagBundle: DAG processor fails to load versioned DAGs due to missing materialized folders #52040
When using GitDagBundle with supports_versioning=True, Airflow DAG Processor fails to execute DAG callbacks because it cannot find the materialized code under versions/<commit_hash>/.
Only the tracking_repo/ folder is updated with the latest version, but when a DAG-level callback (e.g. on_success_callback, on_failure_callback) is triggered, the callback request sent to the DAG Processor points to the versioned folder (e.g. /dag-bundles/git_xxx/versions/<commit_hash>/dag.py), which does not exist by default.
This leads to a failure in the DAG Processor when trying to load the DAG from the file. Specifically, inside DagFileProcessor._execute_dag_callbacks, the following code fails: dag = dagbag.dags[request.dag_id] # returns empty
This happens because dagbag.process_file() cannot find the DAG file at the specified path (versions/<commit_hash>/...), and so the DAG is never loaded, and the callback is silently skipped.
What you think should happen instead
The DAG Processor should also materialize the correct version of the DAG source code (i.e., clone the Git repository to the appropriate versions/<commit_hash> path) before attempting to load and execute DAG-level callbacks.
How to reproduce
Use GitDagBundle with supports_versioning=True.
Define a DAG-level on_failure_callback or on_success_callback.
Deploy a new Git version and trigger a DAG run that invokes the callback.
The DAG tasks execute successfully.
But DAG callback fails because the path in the callback request is under versions/<commit_hash>/, which is not materialized
As a workaround, we patched GitDagBundle.refresh() to also clone the repo into the versions/ directory.
Anything else
In our environment, DAGs are triggered via Asset, but this should not affect the behavior.
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
I believe I have experienced the same issue, currently using Airflow 3.0.6 with versioned DAG Bundles
The DAG level callbacks never execute and the only information is this in the DAG Processor.
--- Supervised process Last chance exception handler ---
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 387, in _fork_main
target()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 172, in _parse_file_entrypoint
result = _parse_file(msg, log)
^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 188, in _parse_file
_execute_callbacks(bag, msg.callback_requests, log)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 230, in _execute_callbacks
_execute_dag_callbacks(dagbag, request, log)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 236, in _execute_dag_callbacks
dag = dagbag.dags[request.dag_id]
~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'email_alert_test_dag'
Then I committed a change to update the log to >>> SUCCESS CALLBACK TRIGGERED VERSION 2 <<<. After waiting for the DAG Processor to refresh it, I got logs like the ones below:
We are experiencing the same issue as @liyude-tw. We are running 3.1.2 on python 3.11 and are using a GitDagBundle set up to track a specific branch.
Looking at the code, it seems like in airflow-core/src/airflow/dag_processing/manager.py, in _add_callback_to_queue, we are missing a call to initialize() on the instantiated dag bundle to ensure the GitDagBundle clones the version to the /versions/ path. Since this is the only place in the code where get_bundle is called with a version supplied, the dag code cannot have been cloned to the version sub-directory before, yet the processor expects the dag to be in the /versions/ directory.
And, for whoever picks this up, the dag processor also needs to honor the stable_bundle_cleanup_ configs as well. Fixing this issue, but not handling cleanup will just cause other problems :)
Activity
boring-cyborg commentedon Jun 22, 2025
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
ephraimbuddy commentedon Aug 11, 2025
Hi @liyude-tw, can I see the error you encountered here?
LucasRoesler commentedon Oct 17, 2025
I believe I have experienced the same issue, currently using Airflow 3.0.6 with versioned DAG Bundles
The DAG level callbacks never execute and the only information is this in the DAG Processor.
aaron-y-chen commentedon Oct 27, 2025
Hi, is this issue still exist? I can't reproduce it from my local device on the current
mainbranch.Here is my setting:
After I ran it, I got logs like the ones below:
Then I committed a change to update the log to
>>> SUCCESS CALLBACK TRIGGERED VERSION 2 <<<. After waiting for the DAG Processor to refresh it, I got logs like the ones below:It seems to be working well on my side.
zenonsk commentedon Nov 12, 2025
We are experiencing the same issue as @liyude-tw. We are running 3.1.2 on python 3.11 and are using a GitDagBundle set up to track a specific branch.
Looking at the code, it seems like in airflow-core/src/airflow/dag_processing/manager.py, in _add_callback_to_queue, we are missing a call to initialize() on the instantiated dag bundle to ensure the GitDagBundle clones the version to the /versions/ path. Since this is the only place in the code where get_bundle is called with a version supplied, the dag code cannot have been cloned to the version sub-directory before, yet the processor expects the dag to be in the /versions/ directory.
2 remaining items
jedcunningham commentedon Dec 18, 2025
And, for whoever picks this up, the dag processor also needs to honor the
stable_bundle_cleanup_configs as well. Fixing this issue, but not handling cleanup will just cause other problems :)dag_processing: initialize versioned bundles for callbacks (apache#52040
aaron-y-chen commentedon Jan 18, 2026
Hi @jedcunningham, thanks for the guidance. I can reproduce the issue now 😄
dag_processing: initialize versioned bundles for callbacks (#52040) (#…
dag_processing: initialize versioned bundles for callbacks (#52040) (#…
dag_processing: initialize versioned bundles for callbacks (#52040) (#…
dag_processing: initialize versioned bundles for callbacks (apache#52040
dag_processing: initialize versioned bundles for callbacks (apache#52040