Skip to content

Fix duplicate plugin names by surfacing import errors#62954

Open
LarytheLord wants to merge 2 commits intoapache:mainfrom
LarytheLord:fix/duplicate-plugin-name-55140
Open

Fix duplicate plugin names by surfacing import errors#62954
LarytheLord wants to merge 2 commits intoapache:mainfrom
LarytheLord:fix/duplicate-plugin-name-55140

Conversation

@LarytheLord
Copy link
Copy Markdown

Summary

Fixes #55140.

When two plugins share the same AirflowPlugin.name, Airflow currently logs a warning and silently skips the duplicate. This can hide the real problem from users (especially when only one plugin appears in UI/API).

This change keeps the current non-blocking behavior (subsequent plugins still load), but also records duplicate plugin-name conflicts as import errors so the issue is visible and actionable.

Changes

  • In airflow.plugins_manager._get_plugins():
    • track loaded plugin names with their source
    • on duplicate name:
      • keep warning log
      • add an explicit entry to import_errors
  • Update unit test coverage in test_plugins_manager.py:
    • test_duplicate_plugin_name_is_reported_and_does_not_prevent_loading_subsequent_plugins
    • verifies duplicate is reported in import_errors while unique plugins still load

Why this approach

  • Surfaces the conflict as a concrete error instead of only a warning.
  • Preserves existing resilience: one bad/duplicate plugin does not block other plugins.

@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Mar 5, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@LarytheLord
Copy link
Copy Markdown
Author

Follow-up validation on this branch:

  • uvx ruff check airflow-core/src/airflow/plugins_manager.py airflow-core/tests/unit/plugins/test_plugins_manager.py
  • uvx ruff format --check airflow-core/src/airflow/plugins_manager.py airflow-core/tests/unit/plugins/test_plugins_manager.py

Both pass.

I also attempted to run the targeted pytest case for test_plugins_manager.py -k duplicate_plugin_name, but this local environment started bootstrapping the full monorepo dependency set and did not complete in a reasonable time window. CI on the PR should run the full project test matrix.

@LarytheLord LarytheLord force-pushed the fix/duplicate-plugin-name-55140 branch from c0eebee to 64edac3 Compare March 6, 2026 14:46
@LarytheLord
Copy link
Copy Markdown
Author

Rebased on latest main to satisfy up-to-date checks. No functional changes beyond the existing fix + test.

@LarytheLord LarytheLord force-pushed the fix/duplicate-plugin-name-55140 branch from 64edac3 to b3bb369 Compare March 12, 2026 17:09
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.

User is able to register multiple plugins using same name

1 participant