Skip to content

Airflow 3.1.0 TriggerDagRunOperator fails with fail_when_dag_is_paused=True #56954

@gopidesupavan

Description

@gopidesupavan

Discussed in #56615

Originally posted by mdenison October 14, 2025
Hello everyone, I am currently in the process of migrating from Airflow 2.x to 3.1.0.

We have a bunch of DAGs we combined into an overarching DAG in order to also run them separately. To achieve this I've used the TriggerDagRunOperator, before the flag fail_when_dag_is_paused was introduced, I had a wrapper that used to look into the DagModel via DagModel.get_dagmodel(dag_id)to check if the DAG is paused. This of course ran into the "Direct database access via the ORM is not allowed in Airflow 3.0" Issue.

I get the same issue with Airflow 3.1.0 using the parameter fail_when_dag_is_paused=True on the TriggerDagRunOperator. I assume that happens since Airflow 3.1.0.

I assume it happens do to https://airflow.apache.org/docs/apache-airflow/stable/installation/upgrading_to_airflow3.html#database-access-restrictions .

But, am I doing something wrong or missing a point?

DAG which shall be triggered:

@dag(dag_id="hello_world", default_args=default_args, schedule=None, max_active_runs=1)
def generate_dag():
    BashOperator(
        task_id="print",
        bash_command='echo hello world',
    )

generate_dag()

DAG which is triggering the other DAG:

@dag(dag_id="run_hello_world", default_args=default_args, schedule=None, max_active_runs=1)
def generate_dag():
    TriggerDagRunOperator(
        task_id="run_hello_world_dag_task",
        trigger_dag_id="hello_world",
        wait_for_completion=True,
        fail_when_dag_is_paused=True,
    )

generate_dag()
```</div>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions