Skip to content

Variable.check_for_write_conflict exits early due to return inside loop #64060

@Kundan-CR7

Description

@Kundan-CR7

Apache Airflow version

3.1.8

If "Other Airflow 3 version" selected, which one?

Issue observed in local development version (main branch)

What happened?

The function Variable.check_for_write_conflict exits prematurely due to a return None
statement inside the loop iterating over secrets backends.

Because of this, only the first backend is evaluated, and the remaining backends are skipped.

This leads to incorrect behavior where potential conflicts in later backends are not detected.

What you think should happen instead?

The function should iterate over all configured secrets backends and only return after
checking all of them.

The return None should not be inside the loop, as it causes early termination.

How to reproduce

  1. Configure multiple secrets backends.
  2. Ensure the first backend does not contain the variable.
  3. Ensure a later backend contains the variable.
  4. Call Variable.check_for_write_conflict.

Expected:
The function should detect the variable in the later backend.

Actual:
The function exits after the first backend and does not check subsequent backends.

Operating System

macOS

Versions of Apache Airflow Providers

Not relevant

Deployment

Other

Deployment details

Testing on local clone of Apache Airflow repository.

Anything else?

Root cause

The issue is caused by a misplaced return None inside the loop:

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:secretskind:bugThis is a clearly a bugpriority:mediumBug that should be fixed before next release but would not block a release

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions