Repository navigation
airflow dags test needs dag to be serialized #53682
Copy link
Copy link
Closed
Labels
area:CLIkind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release
Milestone
Description
#50825 re-introduced the bug where we can't run dags.test or airflow dags test command without Serializing DAG to DB manually. This adds huge friction to local dev.
This was originally fixed in 3.0.2 via #50420
Example failure:
root@40de4aa411de:/opt/airflow# airflow dags test a_dag
[2025-07-23T20:19:51.594+0000] {manager.py:122} INFO - DAG bundles loaded: dags-folder, example_dags
[2025-07-23T20:19:51.594+0000] {dagbag.py:620} INFO - Filling up the DagBag from /files/dags/daga.py
Nothing to clear.
/opt/airflow/providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py:44 DeprecationWarning: The `airflow.utils.task_group.TaskGroup` attribute is deprecated. Please use `'airflow.sdk.definitions.taskgroup.TaskGroup'`.
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 10, in <module>
sys.exit(main())
File "/opt/airflow/airflow-core/src/airflow/__main__.py", line 55, in main
args.func(args)
File "/opt/airflow/airflow-core/src/airflow/cli/cli_config.py", line 48, in command
return func(*args, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/utils/cli.py", line 113, in wrapper
return f(*args, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/utils/providers_configuration_loader.py", line 54, in wrapped_function
return func(*args, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 100, in wrapper
return func(*args, session=session, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/cli/commands/dag_command.py", line 622, in dag_test
dr: DagRun = dag.test(
File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/dag.py", line 1113, in test
dr: DagRun = _get_or_create_dagrun(
File "/opt/airflow/airflow-core/src/airflow/models/dag.py", line 2326, in _get_or_create_dagrun
dr = dag.create_dagrun(
File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 98, in wrapper
return func(*args, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/models/dag.py", line 1581, in create_dagrun
orm_dagrun = _create_orm_dagrun(
File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 98, in wrapper
return func(*args, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/models/dag.py", line 249, in _create_orm_dagrun
raise AirflowException(f"Cannot create DagRun for DAG {dag.dag_id} because the dag is not serialized")
airflow.exceptions.AirflowException: Cannot create DagRun for DAG a_dag because the dag is not serialized
https://github.com/apache/airflow/pull/50825/files#r2226635628
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:CLIkind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release
Activity
Fix `get_dag` function in CLI
Fix `get_dag` function in CLI
Initialize DAG bundles in CLI `get_dag` function
Initialize DAG bundles in CLI `get_dag` function
Initialize DAG bundles and sync dags in CLI `get_dag` function
Initialize DAG bundles and sync dags in CLI `get_dag` function
Initialize DAG bundles and sync dags in CLI `get_dag` function
Initialize DAG bundles and sync dags in CLI `get_dag` function (#53699)
Initialize DAG bundles and sync dags in CLI `get_dag` function (apach…
Initialize DAG bundles and sync dags in CLI `get_dag` function (apach…
phanikumv commentedon Aug 25, 2025
@ephraimbuddy can we close this, looks like we already have a PR?
vatsrahul1001 commentedon Aug 25, 2025
I will verify and close this
phanikumv commentedon Sep 1, 2025
@vatsrahul1001 is this verified?
vatsrahul1001 commentedon Sep 1, 2025
I am not getting the above error now we can trigger now; however, getting the below error now running
airflow dags testephraimbuddy commentedon Sep 1, 2025
we should create a new issue for the new error as dags are now serialized
vatsrahul1001 commentedon Sep 1, 2025
@ephraimbuddy yeah right. Let me close this one and open up a new one.
DFINITYManu commentedon Oct 9, 2025
@vatsrahul1001 you did not open the ticket you offered to open, or at least I can't find it in the Airflow issues list.
tatiana commentedon Oct 15, 2025
This issue still happens for
dag.test(). I just created a new ticket to track this:#56657