Repository navigation
Description
Apache Airflow version
3.0.0
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Recently, I upgraded Airflow from 2.10 to 3.0. I've deployed Airflow behind Nginx. I was able to migrate successfully, except I'm getting state mismatch error if I'm setting base_url in airflow.cfg.
airflow.cfg setting:
[api]
base_url = http://localhost:8080/MLOps
Nginx configuration:
server {
listen 80;
server_name <server_name>;
location /MLOps/ {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-Prefix /MLOps;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
This was working fine in Airflow 2.10 but right now I'm getting state mismatch if I'm trying to access the airflow web server using http://<server IP>/MLOps . Below is the screenshot.
Also, it is working fine if I disable base_url and access the airflow web server locally using http://localhost:8080. The same DAG is running successfully without any error but in that case, I'm not able to access the Airflow web server on http://<server IP>/MLOps. Below is the screenshot for the successful run:
What you think should happen instead?
No response
How to reproduce
Run any DAG with and without base_url behind nginx. Previously, it was working when base_url was under [webserver]
Operating System
Ubuntu server 24.04 LTS
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
Python 3.12.7
Anything else?
I'm getting below log on the consol:
api-server | INFO: 127.0.0.1:60834 - "POST /MLOps/api/v2/dags/MLOps-Flow/dagRuns HTTP/1.0" 200 OK
api-server | INFO: 127.0.0.1:60836 - "GET /MLOps/ui/grid/MLOps-Flow?limit=10&order_by=-run_after HTTP/1.0" 200 OK
scheduler | [2025-05-05T13:22:18.717+0530] {scheduler_job_runner.py:450} INFO - 1 tasks up for execution:
scheduler | <TaskInstance: MLOps-Flow.Check-Model manual__2025-05-05T07:52:18.462299+00:00 [scheduled]>
scheduler | [2025-05-05T13:22:18.717+0530] {scheduler_job_runner.py:522} INFO - DAG MLOps-Flow has 0/16 running and queued tasks
scheduler | [2025-05-05T13:22:18.718+0530] {scheduler_job_runner.py:661} INFO - Setting the following tasks to queued state:
scheduler | <TaskInstance: MLOps-Flow.Check-Model manual__2025-05-05T07:52:18.462299+00:00 [scheduled]>
scheduler | [2025-05-05T13:22:18.719+0530] {scheduler_job_runner.py:767} INFO - Trying to enqueue tasks: [<TaskInstance: MLOps-Flow.Check-Model manual__2025-05-05T07:52:18.462299+00:00 [scheduled]>] for executor: LocalExecutor(parallelism=32)
scheduler | 2025-05-05 13:22:18 [info ] Secrets backends loaded for worker [supervisor] backend_classes=['EnvironmentVariablesBackend'] count=1
api-server | INFO: 127.0.0.1:60852 - "PATCH /execution/task-instances/01969f6e-7537-7274-a7a0-b0f920229cdd/run HTTP/1.1" 404 Not Found
scheduler | [2025-05-05T13:22:19.092+0530] {_client.py:1025} INFO - HTTP Request: PATCH http://localhost:8080/execution/task-instances/01969f6e-7537-7274-a7a0-b0f920229cdd/run "HTTP/1.1 404 Not Found"
scheduler | 2025-05-05 13:22:19 [warning ] Server error [airflow.sdk.api.client] detail=None
scheduler | 2025-05-05 13:22:19 [info ] Process exited [supervisor] exit_code=<Negsignal.SIGKILL: -9> pid=3532257 signal_sent=SIGKILL
scheduler | [2025-05-05T13:22:19.098+0530] {local_executor.py:96} ERROR - uhoh
scheduler | Traceback (most recent call last):
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/executors/local_executor.py", line 92, in _run_worker
scheduler | _execute_work(log, workload)
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/executors/local_executor.py", line 113, in _execute_work
scheduler | supervise(
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 1313, in supervise
scheduler | process = ActivitySubprocess.start(
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 785, in start
scheduler | proc._on_child_started(ti=what, dag_rel_path=dag_rel_path, bundle_info=bundle_info)
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 796, in _on_child_started
scheduler | ti_context = self.client.task_instances.start(ti.id, self.pid, start_date)
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 146, in start
scheduler | resp = self.client.patch(f"task-instances/{id}/run", content=body.model_dump_json())
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 1218, in patch
scheduler | return self.request(
scheduler | ^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
scheduler | return copy(f, *args, **kw)
scheduler | ^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
scheduler | do = self.iter(retry_state=retry_state)
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
scheduler | result = action(retry_state)
scheduler | ^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
scheduler | self._add_action_func(lambda rs: rs.outcome.result())
scheduler | ^^^^^^^^^^^^^^^^^^^
scheduler | File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
scheduler | return self.__get_result()
scheduler | ^^^^^^^^^^^^^^^^^^^
scheduler | File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
scheduler | raise self._exception
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
scheduler | result = fn(*args, **kwargs)
scheduler | ^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 629, in request
scheduler | return super().request(*args, **kwargs)
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 825, in request
scheduler | return self.send(request, auth=auth, follow_redirects=follow_redirects)
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 914, in send
scheduler | response = self._send_handling_auth(
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth
scheduler | response = self._send_handling_redirects(
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 999, in _send_handling_redirects
scheduler | raise exc
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/httpx/_client.py", line 982, in _send_handling_redirects
scheduler | hook(response)
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 117, in raise_on_4xx_5xx_with_note
scheduler | return get_json_error(response) or response.raise_for_status()
scheduler | ^^^^^^^^^^^^^^^^^^^^^^^^
scheduler | File "/DCoE/.virtualenvs/MLOps/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 107, in get_json_error
scheduler | raise err
scheduler | airflow.sdk.api.client.ServerResponseError: Not Found
scheduler | Correlation-id=01969f6e-765f-7d75-a85e-6259df9345cc
scheduler | [2025-05-05T13:22:19.802+0530] {scheduler_job_runner.py:810} INFO - Received executor event with state failed for task instance TaskInstanceKey(dag_id='MLOps-Flow', task_id='Check-Model', run_id='manual__2025-05-05T07:52:18.462299+00:00', try_number=1, map_index=-1)
scheduler | [2025-05-05T13:22:19.805+0530] {scheduler_job_runner.py:852} INFO - TaskInstance Finished: dag_id=MLOps-Flow, task_id=Check-Model, run_id=manual__2025-05-05T07:52:18.462299+00:00, map_index=-1, run_start_date=None, run_end_date=None, run_duration=None, state=queued, executor=LocalExecutor(parallelism=32), executor_state=failed, try_number=1, max_tries=1, pool=default_pool, queue=default, priority_weight=1, operator=_PythonDecoratedOperator, queued_dttm=2025-05-05 07:52:18.718501+00:00, scheduled_dttm=2025-05-05 07:52:18.706514+00:00,queued_by_job_id=64, pid=None
scheduler | [2025-05-05T13:22:19.806+0530] {scheduler_job_runner.py:925} ERROR - DAG 'MLOps-Flow' for task instance <TaskInstance: MLOps-Flow.Check-Model manual__2025-05-05T07:52:18.462299+00:00 [queued]> not found in serialized_dag table
scheduler | [2025-05-05T13:22:19.806+0530] {taskinstance.py:2459} ERROR - Executor LocalExecutor(parallelism=32) reported that the task instance <TaskInstance: MLOps-Flow.Check-Model manual__2025-05-05T07:52:18.462299+00:00 [queued]> finished with state failed, but the task instance's state attribute is queued. Learn more: https://airflow.apache.org/docs/apache-airflow/stable/troubleshooting.html#task-state-changed-externally
scheduler | [2025-05-05T13:22:19.810+0530] {taskinstance.py:2582} INFO - Marking task as UP_FOR_RETRY. dag_id=MLOps-Flow, task_id=Check-Model, run_id=manual__2025-05-05T07:52:18.462299+00:00, logical_date=20250505T075216, start_date=, end_date=20250505T075219
dag-processor | [2025-05-05T13:22:22.989+0530] {manager.py:523} INFO - Not time to refresh bundle dags-folder
triggerer | 2025-05-05 13:22:26 [info ] 0 triggers currently running [airflow.jobs.triggerer_job_runner]
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct


Activity
boring-cyborg commentedon May 5, 2025
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
dlira-sf commentedon May 6, 2025
I am encountering the same situation. Using Python 3.12.10, Ubuntu 24.04 (Heroku-24), Airflow 3.0.0, Postgres 17 database. Have you noticed the logs for failing tasks not being found with a
No host suppliederror? Thenot found in serialized_dag tableerror occurs for me, although I can query the database and find the dag in the table.amanchaudhary-95 commentedon May 6, 2025
Yes, that is correct.
ERROR - DAG 'xyz' for task instance <xxxxxxxxxx manual__2025-05-06T17:43:56.001406+00:00 [queued]> not found in serialized_dag tableis there. I even tried the official tutorial on Airflow link, but the issue is still the same. Even tried to run it without nginx, just by putting a route onbase_urlasbase_url = http://localhost:8080/airflow, still getting the same error. The issue seems to be with the airflow itself, or maybe someone can help us resolve the issue.pierrejeambrun commentedon May 7, 2025
The execution API is not reachable because you did not specify
execution_api_server_urlin your config. Its trying to reachhttp://localhost:8080/execution/task-instances/01969f6e-7537-7274-a7a0-b0f920229cdd/runwhile this is not the correct URL since it's been moved.When you update
base_urlyou also need to setexecution_api_server_url, in you case (supposing you are not deploying the execution api in standalone mode)http://localhost:8080/MLOps/execution/In
3.0.1execution_api_server_urlwill default to{BASE_URL}/execution/to avoid confusions.Closing, feel free to re-open if needed.
amanchaudhary-95 commentedon May 7, 2025
Thanks for the help, this solved the issue.