Skip to main content

Fixed: "ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly." in Apache Airflow®

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

Every time I started Apache Airflow® 3.4.0 with airflow standalone, the scheduler and the triggerer each printed the same warning from uvicorn: ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly. Nothing was broken. Here's where it comes from, what I reported upstream, and the setting that hides it until the fix is released.

What I Was Doing​

I had installed Airflow 3.4.0 with uv on Python 3.14. In a terminal with the project's virtual environment active and AIRFLOW_HOME set, I started it:

Terminal
airflow standalone

airflow standalone starts every part of Airflow in one terminal and begins each line it prints with the name of the part that printed it.

What I Expected​

Each part starting up, and then Airflow is ready.

What I Got​

Airflow started and printed Airflow is ready, but on the way, the scheduler and the triggerer each printed a warning:

Output (excerpt)
scheduler | 2026-12-04T10:26:23.012829Z [info ] Starting log server on http://[::]:8793 [airflow.utils.serve_logs.core] loc=core.py:50
triggerer | 2026-12-04T10:26:23.066130Z [info ] Starting log server on http://[::]:8794 [airflow.utils.serve_logs.core] loc=core.py:50
scheduler | 2026-12-04T10:26:24.250508Z [warning ] ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly. [uvicorn.error] loc=config.py:521
triggerer | 2026-12-04T10:26:24.250628Z [warning ] ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly. [uvicorn.error] loc=config.py:521
scheduler | 2026-12-04T10:26:24.250809Z [info ] Started server process [7747] [uvicorn.error] loc=server.py:103
scheduler | 2026-12-04T10:26:24.250871Z [info ] Waiting for application startup. [uvicorn.error] loc=on.py:48
triggerer | 2026-12-04T10:26:24.250888Z [info ] Started server process [7749] [uvicorn.error] loc=server.py:103
triggerer | 2026-12-04T10:26:24.251062Z [info ] Waiting for application startup. [uvicorn.error] loc=on.py:48
scheduler | 2026-12-04T10:26:24.254253Z [info ] Application startup complete. [uvicorn.error] loc=on.py:62
triggerer | 2026-12-04T10:26:24.254822Z [info ] Application startup complete. [uvicorn.error] loc=on.py:62
scheduler | 2026-12-04T10:26:24.257688Z [info ] Uvicorn running on http://:8793 (Press CTRL+C to quit) [uvicorn.error] loc=server.py:234
triggerer | 2026-12-04T10:26:24.257759Z [info ] Uvicorn running on http://:8794 (Press CTRL+C to quit) [uvicorn.error] loc=server.py:234

The airflow standalone output: the scheduler and the triggerer start log servers on ports 8793 and 8794, each prints the warning ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly. from uvicorn.error, and then Uvicorn running on http://:8793 and http://:8794.

Each warning comes right after a Starting log server line, and the servers started anyway: the last two lines say Uvicorn running on ports 8793 and 8794. The same two warnings came back every time I started Airflow.

The full output has other warnings too, which I left out here: Fixed: FileType is deprecated and Fixed: The HMAC key is 24 bytes long explain them.

What I Checked​

What uvicorn and ASGI are. uvicorn is a web server for Python apps. ASGI is the standard way such a server and a Python web app talk to each other, and an app factory is a function that builds the app when it's called. Airflow runs its web apps with uvicorn: the API server behind the UI, and the log servers.

Which servers warn. Only the log servers. Airflow's configuration reference describes the log server as "a tiny web server subprocess to serve the workers local log files to the airflow main web server". In airflow standalone, the scheduler runs the tasks, so it starts one on port 8793, the default of [logging] worker_log_server_port. The triggerer starts another on 8794, the default of [logging] trigger_log_server_port. The API server, which uvicorn runs too, printed no such warning.

Where the warning comes from. loc=config.py:521 points into uvicorn's own config.py. When uvicorn is given the name of an app, it imports it and tries to call it with no arguments. If the call works and its factory setting is off, it logs this warning and uses what the call returned:

uvicorn/config.py (uvicorn 0.54.0, excerpt)
self.loaded_app = self.load_app()

try:
self.loaded_app = self.loaded_app()
except TypeError as exc:
if self.factory:
logger.error("Error loading ASGI app factory: %s", exc)
sys.exit(STARTUP_FAILURE)
else:
if not self.factory:
logger.warning(
"ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly."
)

logger here is uvicorn's logger named uvicorn.error, the name the warning line shows. uvicorn's settings documentation describes --factory as treating the app "as an application factory, i.e. a () -> <ASGI app> callable".

How Airflow starts its log servers. In airflow/utils/serve_logs/core.py, Airflow names get_app, a function that builds the log server's app, and doesn't pass factory=True:

airflow/utils/serve_logs/core.py (Airflow 3.4.0, excerpt)
uvicorn.run(
"airflow.utils.serve_logs.log_server:get_app",
host="",
port=port,
log_level=uvicorn_log_level,
log_config=None,
access_log=False,
)

The API server names airflow.api_fastapi.main:app instead, which is the app itself. Calling an app with no arguments raises a TypeError, so uvicorn uses it as it is and doesn't warn.

Upstream. I reported it as apache/airflow#77806. A fix that passes factory=True, apache/airflow#77839, was open and not yet merged on 2026-12-04.

Why It Happens​

Airflow 3.4.0 starts each log server by giving uvicorn the name of a function that builds the app, without saying it's a factory. uvicorn works that out by itself and warns, once for the scheduler's log server and once for the triggerer's.

The Fix​

The real fix is in Airflow's code: when a release includes it, upgrade. Until then, the warning is harmless, because uvicorn uses the factory correctly and both log servers start, so you can leave it alone.

To hide it, lower uvicorn's logging level. The configuration reference describes [logging] uvicorn_logging_level as the "Logging level for uvicorn (API server and serve-logs)", with INFO as its default. Stop Airflow with Ctrl+C, then start it again with the setting at ERROR, through its environment variable:

Terminal
export AIRFLOW__LOGGING__UVICORN_LOGGING_LEVEL=ERROR
airflow standalone
  • AIRFLOW__LOGGING__UVICORN_LOGGING_LEVEL sets uvicorn_logging_level in the [logging] section. How to Change the Port and Host of the Apache Airflow® API Server explains how these names are built.
  • ERROR makes uvicorn show only errors. Its supported values are CRITICAL, ERROR, WARNING, INFO and DEBUG; the message is a warning, so it takes ERROR or CRITICAL to hide it.
  • export sets the variable for this terminal only.

The setting covers every uvicorn server Airflow runs, so uvicorn's four start-up lines go too, for the API server as well: Started server process, Waiting for application startup., Application startup complete. and Uvicorn running on.

After the Fix​

I started Airflow again with the variable set. The log servers started as before, without the warnings:

Output (excerpt)
scheduler | 2026-12-04T12:44:20.557285Z [info ] Starting log server on http://[::]:8793 [airflow.utils.serve_logs.core] loc=core.py:50
triggerer | 2026-12-04T12:44:20.613959Z [info ] Starting log server on http://[::]:8794 [airflow.utils.serve_logs.core] loc=core.py:50
...
standalone | Airflow is ready

The airflow standalone output after setting AIRFLOW__LOGGING__UVICORN_LOGGING_LEVEL to ERROR: the scheduler and the triggerer start their log servers on ports 8793 and 8794 with no warning after them, and later standalone prints Airflow is ready.

The whole output had no ASGI app factory detected line, and both log servers were listening on ports 8793 and 8794. The API server still printed its own banner with the host and port it listens on, because that banner comes from Airflow, not from uvicorn.

Common Mistakes​

MistakeWhat happensDo this instead
Adding --factory to airflow standaloneairflow command error: unrecognized arguments: --factory, see help above. and exit code 2. The flag belongs to uvicorn's own command, not to Airflow'sLeave the warning alone, or set uvicorn_logging_level
Hiding it with a PYTHONWARNINGS filterWith PYTHONWARNINGS="ignore:ASGI app factory detected" set, both warnings still appeared: the line is a log message from the uvicorn.error logger, not a Python warningSet uvicorn_logging_level to ERROR

Troubleshooting​

SymptomLikely causeFix
ASGI app factory detected twice at every startAirflow 3.4.0's log servers start uvicorn without factory=TrueNothing is broken; hide it with AIRFLOW__LOGGING__UVICORN_LOGGING_LEVEL=ERROR
The warning is still there after the exportThe variable was set in another terminal, or Airflow wasn't restartedRun the export in the terminal you start Airflow from, then start Airflow again
The Uvicorn running on lines are goneuvicorn_logging_level is ERRORExpected. Open a new terminal without the variable to get them back

FAQ​

Is the warning harmful?​

No. uvicorn detects the factory, uses it, and the log servers start: the lines right after it say Uvicorn running on ports 8793 and 8794.

Does uvicorn_logging_level hide the API server's request lines too?​

No. The API server writes its request finished lines through Airflow's own http.access logger, not through uvicorn, and they kept appearing with the setting at ERROR.

Conclusion​

ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly. came from uvicorn, because Airflow 3.4.0 starts the log servers of the scheduler and the triggerer by naming a factory function without factory=True. It's harmless. Until the fix is released, AIRFLOW__LOGGING__UVICORN_LOGGING_LEVEL=ERROR hides it, along with uvicorn's start-up lines.

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.