Skip to content

Fix malformed GitDagBundle error message for missing repository path - #70622

Merged
Miretpl merged 3 commits into
apache:mainfrom
WonYong-Jang:fix-gitdagbundle-error-message
Aug 6, 2026
Merged

Miretpl merged 3 commits into
apache:mainfrom
WonYong-Jang:fix-gitdagbundle-error-message

Conversation

@WonYong-Jang

@WonYong-Jang WonYong-Jang commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

The error message shown when the repository path is missing was broken.
In GitDagBundle._clone_repo_if_required, the code was:

raise AirflowException("Repository path: %s not found", self.bare_repo_path)

This looks like it should put the path where %s is, but AirflowException does not do that.
When you pass the message and the value as two separate arguments, python just keeps both of them, so the error came out as:

 ('Repository path: %s not found', '/path/to/bare')

instead of a clear message.

The fix uses an f-string, which puts the path into the text directly. Now the message reads:

Repository path: /path/to/bare not found

There was also a test that checked for the old, broken text, so it was passing even though the code was wrong. The test now checks for the correct message.


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@WonYong-Jang WonYong-Jang changed the title Fix malformed GitdagBundle error message for missing repository path Fix malformed GitDagBundle error message for missing repository path Jul 28, 2026
@WonYong-Jang
WonYong-Jang force-pushed the fix-gitdagbundle-error-message branch from adcddb6 to 9942768 Compare July 28, 2026 13:30
@WonYong-Jang
WonYong-Jang marked this pull request as ready for review July 28, 2026 13:30
@potiuk

potiuk commented Aug 1, 2026

Copy link
Copy Markdown
Member

Good catch — this is a real bug. AirflowException("...%s...", value) doesn't interpolate; both arguments are kept, so the message rendered as a tuple rather than a path. The f-string is the right fix, and tightening the test to an exact-equality assertion against the real path is exactly what it needed.

One thing before this goes in. The project is actively reducing direct AirflowException usages, and the guidance is that when you touch a line that raises one, narrow it rather than leave it behind. Here the except clause tells you the specific failure — the path isn't there — so FileNotFoundError fits:

except NoSuchPathError as e:
    # Protection should the bare repo be removed manually
    raise FileNotFoundError(f"Repository path: {self.bare_repo_path} not found") from e

The same method already does this a few lines above, so it stays consistent with its neighbours:

raise RuntimeError("Error cloning repository") from e
raise RuntimeError(f"Invalid git repository at {self.bare_repo_path}") from e

Two follow-on edits if you take it:

  • the test's pytest.raises(AirflowException) becomes pytest.raises(FileNotFoundError)
  • generated/known_airflow_exceptions.txt has providers/git/src/airflow/providers/git/bundles/git.py::5 — drop it to ::4, otherwise the ratchet check fails

Happy to merge once that's in.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

@WonYong-Jang

Copy link
Copy Markdown
Contributor Author

Good catch — this is a real bug. AirflowException("...%s...", value) doesn't interpolate; both arguments are kept, so the message rendered as a tuple rather than a path. The f-string is the right fix, and tightening the test to an exact-equality assertion against the real path is exactly what it needed.

One thing before this goes in. The project is actively reducing direct AirflowException usages, and the guidance is that when you touch a line that raises one, narrow it rather than leave it behind. Here the except clause tells you the specific failure — the path isn't there — so FileNotFoundError fits:

except NoSuchPathError as e:
    # Protection should the bare repo be removed manually
    raise FileNotFoundError(f"Repository path: {self.bare_repo_path} not found") from e

The same method already does this a few lines above, so it stays consistent with its neighbours:

raise RuntimeError("Error cloning repository") from e
raise RuntimeError(f"Invalid git repository at {self.bare_repo_path}") from e

Two follow-on edits if you take it:

  • the test's pytest.raises(AirflowException) becomes pytest.raises(FileNotFoundError)
  • generated/known_airflow_exceptions.txt has providers/git/src/airflow/providers/git/bundles/git.py::5 — drop it to ::4, otherwise the ratchet check fails

Happy to merge once that's in.

Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

Thank you for the review! Applied all three changes.

@Miretpl

Miretpl commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@WonYong-Jang could you resolve a conflicts?

@WonYong-Jang
WonYong-Jang force-pushed the fix-gitdagbundle-error-message branch from 1c077c2 to e0271a7 Compare August 5, 2026 03:06
@WonYong-Jang

Copy link
Copy Markdown
Contributor Author

@WonYong-Jang could you resolve a conflicts?

@Miretpl @potiuk
Resolved conflicts. Thanks

@WonYong-Jang
WonYong-Jang force-pushed the fix-gitdagbundle-error-message branch from d463c82 to da02c99 Compare August 5, 2026 12:28
@Miretpl
Miretpl merged commit 299ca2c into apache:main Aug 6, 2026
2 checks passed
@amoghrajesh amoghrajesh added this to the Airflow 3.3.2 milestone Aug 10, 2026
@vatsrahul1001 vatsrahul1001 removed this from the Airflow 3.3.2 milestone Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants