Repository navigation
Description
Under which category would you file this issue?
Airflow Core
Apache Airflow version
3.4.0
What happened and how to reproduce it?
Issue description
DagBundlesManager.parse_config keys bundles by name only. Nothing compares where the bundles read their files from. So if the same Git repository, branch and subdir are configured twice, once with an SSH URL and once with an HTTPS URL, Airflow accepts both bundles and treats them as two independent DAG sources:
- The DAG processor clones/fetches the repository twice and parses every file twice.
- Import errors are stored per
(bundle_name, filename), so every broken file is reported twice in the UI. dag_idis global, so each DAG is stored once andDagModel.bundle_nameis whichever bundle parsed it last. Ownership keeps switching between the two bundles from one parse loop to the next.- 3.4.0 adds a
DUPLICATE_DAG_IDDagWarning (Warn in UI when the same dag_id is registered from multiple files #68791) to every affected DAG, so the UI fills with warnings that all have the same root cause. - From reading the code (not yet observed):
SerializedDagModel.write_dagonly reuses aDagVersionwhen the bundle name is unchanged, so once a DAG has task instances, every ownership switch writes a newDagVersion.
This is easy to hit when the bundle list is generated (for example by a Kubernetes operator or a deployment UI), because SSH and HTTPS look like two different repositories unless the URLs are normalized.
Related: #76551 and its PR #76556 handle the general case of the same dag_id in two different bundles (keep the first owner, import error for the second). This issue is about the narrower, earlier case: two bundle entries that are really the same source. Even with #76556 merged, this configuration still clones and parses everything twice, and the second bundle ends up with an import error for every DAG. That can be caught at config-parse time, before any parsing happens.
Steps to reproduce
- Use any Git repository with DAGs under
dags/on branchmain(placeholder:example-org/example-dagsbelow). - Create a Git connection
git_sshwhoseextrahas{"key_file": "/path/to/id_ed25519"}with read access to the repository. - Configure two bundles that point at the same repository, branch and subdir, one over SSH and one over HTTPS:
[dag_processor]
dag_bundle_config_list = [
{
"name": "dags_ssh",
"classpath": "airflow.providers.git.bundles.git.GitDagBundle",
"kwargs": {
"git_conn_id": "git_ssh",
"repo_url": "[email protected]:example-org/example-dags.git",
"tracking_ref": "main",
"subdir": "dags"
}
},
{
"name": "dags_https",
"classpath": "airflow.providers.git.bundles.git.GitDagBundle",
"kwargs": {
"repo_url": "https://github.com/example-org/example-dags.git",
"tracking_ref": "main",
"subdir": "dags"
}
}
]- Start the DAG processor, scheduler and API server. Both bundles are loaded without any warning (
DAG bundles loaded: dags_ssh, dags_https). - Wait for a few parse loops, then compare DAG ownership and import errors:
airflow dags list -o json > dags.json
airflow dags list-import-errors -o json > errors.json
python3 - <<'PY'
import json
from collections import Counter
dags = json.load(open("dags.json"))
errs = json.load(open("errors.json"))
print("dags", len(dags), Counter(d["bundle_name"] for d in dags))
print("import_errors", len(errs), Counter(e["bundle_name"] for e in errs))
print("distinct_error_files", len({e["filepath"] for e in errs}))
PYObserved (real deployment, one repository, branch main, subdir dags/)
| Value | |
|---|---|
| DAGs (each stored once) | 41 |
| DAGs owned by the SSH / HTTPS bundle at that moment | 28 / 13 |
| Import errors in the UI | 32 |
| Distinct files behind those errors | 16 (every one reported by both bundles, same error text) |
Running the script again later gives a different SSH/HTTPS split, because ownership goes to whichever bundle parsed the file last.
Where this comes from (3.4.0)
DagBundlesManager.parse_configstoresself._bundle_config[bundle_config.name]and never looks at the bundle kwargs._build_duplicate_dag_id_warningsonly records a warning ("…which is now overwritten by this file").- Import errors are keyed by
(bundle_name, filename). dag-bundles.rstsays bundles can be combined but says nothing about two bundles reading the same source. The duplicate dag_id FAQ asks for unique dag_ids but does not mention this cause.
What you think should happen instead?
The same repository + branch + subdir should be one DAG source, no matter whether it is reached over SSH or HTTPS. Airflow should at least tell the operator that two configured bundles read the same files, instead of silently parsing them twice and letting dag_id ownership flip.
Suggested, in order of how small and safe the change is:
- Docs: in
dag-bundles.rst, next to "You can combine multiple bundle types", state that two bundles must not read the same source, and link the duplicate-dag_id FAQ. Add this cause to the FAQ entry. - Opt-in detection at config parse time: add an optional classmethod on
BaseDagBundle, e.g.source_key(**kwargs) -> Hashable | None(defaultNone).GitDagBundlereturns(normalized repo_url, tracking_ref, subdir.strip("/")), where normalization mapsgit@host:path,ssh://user@host:port/pathandhttps://user@host/path(.git)tohost/path(lower-cased host, no user, port or.git). It can reuse the existingGitDagBundle._convert_git_ssh_url_to_https.DagBundlesManager.parse_configlogs a warning when two bundles return the same key, and raisesAirflowConfigExceptionwhen a new flag such as[dag_processor] reject_duplicate_bundle_sources = Trueis set. Call the hook throughgetattrso newer providers keep working with older cores. Ifrepo_urlcomes only from the connection, the key is unknown at parse time and the check is skipped.
The general duplicate-dag_id ownership fix is tracked separately in #76551 / #76556 and complements this one.
Operating System
Linux container (Python 3.12). Not OS-specific: the behaviour comes from bundle config parsing.
Deployment
Other 3rd-party Helm chart
Apache Airflow Provider(s)
git
Versions of Apache Airflow Providers
apache-airflow-providers-git==1.0.1
Official Helm Chart version
Not Applicable
Kubernetes Version
Not Applicable (not specific to Kubernetes; reproducible with any deployment that has two Git bundles)
Helm Chart configuration
Not Applicable
Docker Image customizations
Custom image with Airflow 3.4.0 and apache-airflow-providers-git==1.0.1. Not relevant to the issue: the code paths involved are the upstream ones linked above.
Anything else?
- Happens every time both bundles are configured; it is not intermittent. Only the SSH/HTTPS split of DAG ownership changes between runs.
- Not a regression in a specific release: 2.x had a single
dags_folder, so a repository could not be loaded twice; 3.0–3.3 have bundles with no cross-bundle check; 3.4.0 adds theDUPLICATE_DAG_IDwarning but still overwrites. - The same pattern applies to nested subdirs of one repository and branch (
subdir=""andsubdir="dags"), which also parse files twice. That one can be intentional, so it is probably a warning at most. - Workaround: configure each repository/branch/subdir only once.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
boring-cyborg commentedon Nov 18, 2026
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.
basantjamwal commentedon Nov 18, 2026
Hi, I'd like to work on this.
Reproduced on the latest
apache/airflowDocker image (standalone) with twoLocalDagBundles (a,b) pointing at the same folder:DAG bundles loaded: a, bis logged with no warning.a good.pyandb good.pyin the processing stats).dag_idownership flips on every parse loop (every ~30s):airflow dags list-import-errors, once for bundleaand once forb, with the same error text.Plan (two small PRs):
dag-bundles.rstand the duplicate dag_id FAQ that two bundles must not read the same source.source_key()hook onBaseDagBundle.GitDagBundlewould return a normalized(repo_url, tracking_ref, subdir), with SSH and HTTPS URLs mapped to the same key.parse_configwould log a warning when two bundles share a key.I'd leave the
reject_duplicate_bundle_sourcesflag for a follow-up if maintainers want it.Happy to adjust the approach if maintainers prefer something different.
Warn when two Dag bundles read the same source
meel-ayush commentedon Nov 20, 2026
Agreed. #76556 acts as the DB safety net to prevent task crashes if collisions occur, while #77375 catches duplicate sources at config parse time to stop duplicate cloning. Both complement each other.