Skip to main content

How to Trigger a Dag from the Command Line with airflow dags trigger

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

The Apache Airflow® UI has a Trigger button, but the terminal is often quicker, and it's the way to start a Dag from a script. airflow dags trigger creates a run of a Dag, and airflow dags list-runs shows how it went. This guide triggers a one-task Dag with both, on Airflow 3.4.0, including the step that keeps the run from waiting forever.

Syntax​

Syntax
airflow dags trigger <dag_id> [--conf '<JSON>'] [--logical-date <date>] [--run-id <id>]
PartWhat it means
<dag_id>The Dag to run, such as hello_cli
--conf '<JSON>'Optional settings for this run, as JSON, for a Dag that reads them
--logical-date <date>Optional: the date the run is for
--run-id <id>Optional: your own name for the run. Airflow generates one otherwise

The command's help adds the catch: "If DAG is paused then dagrun state will remain queued, and the task won't run."

Prerequisites​

  • Apache Airflow® running, with the scheduler, for example with airflow standalone.
  • A terminal with the same AIRFLOW_HOME and the virtual environment activated.

Step 1: Make Sure the Dag Is Unpaused​

New Dags start paused, and a run of a paused Dag waits in the queue without starting. Switch the Dag's toggle on in the UI first; How to Pause and Unpause a Dag in Apache Airflow® shows where it is.

Step 2: Trigger It​

Terminal
airflow dags trigger hello_cli
Output
conf | dag_id | dag_run_id | data_interval_start | data_interval_end | end_date | last_scheduling_decision | logical_date | run_type | start_date | state | triggering_user_name
=====+===========+==========================================+=====================+===================+==========+==========================+==============+==========+============+========+=====================
{} | hello_cli | manual__2026-12-01T04:25:05.454413+00:00 | None | None | None | None | None | manual | None | queued | you

The terminal after airflow dags trigger hello_cli: the new run manual__2026-12-01T04:25:05.454413+00:00 with run_type manual, state queued and an empty conf.

The run exists, with the ID manual__ plus the time, run_type manual, and the state queued: it waits for the scheduler to pick it up. logical_date is None because none was given; in Airflow 3, a hand-started run doesn't need one. triggering_user_name is the user name you're signed in to your computer as (mine shows you). I left out the warning lines that every airflow dags command prints first, and one log line, creating dag run.

Step 3: Check How It Went​

Terminal
airflow dags list-runs hello_cli
Output
dag_id | run_id | state | run_after | logical_date | start_date | end_date
==========+==========================================+=========+==================================+==============+==================================+=================================
hello_cli | manual__2026-12-01T04:25:05.454413+00:00 | success | 2026-12-01T04:25:05.454413+00:00 | | 2026-12-01T04:25:06.335104+00:00 | 2026-12-01T04:25:11.366580+00:00

The terminal after airflow dags list-runs hello_cli: the run with state success, started at 04:25:06 and ended at 04:25:11.

The run started a second after the trigger and finished with success five seconds later.

Common Mistakes​

MistakeWhat happensDo this instead
Triggering a paused DagThe run stays queued and the task doesn't run, as the help saysUnpause the Dag first
A terminal without AIRFLOW_HOMEThe command uses ~/airflow, a different database without your DagExport the same AIRFLOW_HOME as the running Airflow
--conf with invalid JSON, such as '{bad'A traceback ending in json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes, and no runWrite valid JSON in single quotes: --conf '{"key": "value"}'

Troubleshooting​

SymptomLikely causeFix
The run stays queuedThe Dag is paused, or the scheduler isn't runningUnpause it; start Airflow

FAQ​

Does it need the UI running?​

The command writes the run straight to Airflow's database. The scheduler then starts it, so the scheduler has to run, but the UI doesn't.

How do I pass settings to the run?​

--conf '{"key": "value"}'. The Dag reads them from the run's conf; the column was {} here because none were passed.

Conclusion​

With hello_cli unpaused, airflow dags trigger created the run manual__2026-12-01T04:25:05.454413+00:00 in the queued state, and airflow dags list-runs showed it as success five seconds later.

Additional Resources​

Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.