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:
-
Option A (Preferred): The SDK should read the config value like Airflow 2.x did, maintaining backward compatibility for users who set these configs.
-
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
-
Set environment variable:
export AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE=False
-
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
}
-
Trigger a task failure
-
Expected (Airflow 2.x behavior): No email sent (config is False)
-
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?
Code of Conduct
Apache Airflow version
3.1.4 (also affects 3.0.x, 3.1.x)
What happened?
The configuration option
default_email_on_failure(anddefault_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):
SDK behavior (ignores config):
Airflow 2.x behavior (read from config):
What you think should happen instead?
One of the following:
Option A (Preferred): The SDK should read the config value like Airflow 2.x did, maintaining backward compatibility for users who set these configs.
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_failureexplicitly indefault_argsinstead.Currently there's an inconsistency:
email,email_on_failure) are deprecated with warnings pointing toSmtpNotifier(PR Deprecating email, email_on_retry, email_on_failure in BaseOperator #47146)default_email_on_failure) are still documented without deprecation notices, but are silently ignoredHow to reproduce
Set environment variable:
export AIRFLOW__EMAIL__DEFAULT_EMAIL_ON_FAILURE=FalseCreate a DAG with
emailset but no explicitemail_on_failure:Trigger a task failure
Expected (Airflow 2.x behavior): No email sent (config is
False)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=Falseindefault_args:Are you willing to submit PR?
Code of Conduct