Skip to content

[Airflow 3.x] AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE config exists but is not read by SDK #59380

@erinforman

Description

@erinforman

Apache Airflow version

3.1.4 (also affects 3.0.x, 3.1.x)

What happened?

The configuration option default_email_on_failure (and default_email_on_retry) is documented in the Configuration Reference and present in the config template, but the Airflow 3 SDK does not read this value.

Configuration (documented and present in config template):

# config_templates/config.yml
default_email_on_failure:
  description: |
    Whether email alerts should be sent when a task failed
  version_added: 2.0.0
  type: boolean
  default: "True"

SDK behavior (ignores config):

# airflow/sdk/bases/operator.py - Line 217
OPERATOR_DEFAULTS: dict[str, Any] = {
    "email_on_failure": True,  # Hardcoded, does not read from config
    "email_on_retry": True,
}

Airflow 2.x behavior (read from config):

# airflow/models/baseoperator.py
email_on_failure: bool = conf.getboolean("email", "default_email_on_failure", fallback=True)

What you think should happen instead?

One of the following:

  1. Option A (Preferred): The SDK should read the config value like Airflow 2.x did, maintaining backward compatibility for users who set these configs.

  2. Option B: If the config is intentionally no longer used, it should be marked as deprecated in the configuration reference and config template, with a note directing users to set email_on_failure explicitly in default_args instead.

Currently there's an inconsistency:

How to reproduce

  1. Set environment variable:

    export AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE=False
  2. Create a DAG with email set but no explicit email_on_failure:

    default_args = {
        "email": ["team@example.com"],
        # email_on_failure not set - should inherit from config
    }
  3. Trigger a task failure

  4. Expected (Airflow 2.x behavior): No email sent (config is False)

  5. Actual (Airflow 3.x behavior): Email attempted (SDK hardcodes True)

Operating System

Linux / macOS

Versions of Apache Airflow Providers

N/A - core issue

Deployment

Docker-Compose, Kubernetes (Helm)

Deployment details

No response

Anything else?

Related:

Workaround: Explicitly set email_on_failure=False in default_args:

default_args = {
    "email": ["team@example.com"],
    "email_on_failure": False,  # Must be explicit in Airflow 3
}

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions