You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jgoedeke (via GitHub)" <gi...@apache.org> on 2025/09/09 06:52:31 UTC
[I] Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3 [airflow]
jgoedeke opened a new issue, #55410:
URL: https://github.com/apache/airflow/issues/55410
### Apache Airflow version
3.0.6
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
In Airflow 3 (TaskFlow), returning a dict from a `@task` where one of the dict KEYS contains a "/" causes the task to fail at the end during XCom push with:
AirflowRuntimeError: `API_SERVER_ERROR: {'status_code': 404, 'message': 'Not Found', 'detail': {'detail': 'Not Found'}}`.
The same code works when the dict keys do NOT contain "/".
It looks like when `@task` returns a dict and Airflow treats it as multiple outputs, it creates one XCom per dictionary key. Those per-key XCom writes go through the Execution API and the XCom KEY is placed in the URL path. If the key contains "/", the path is split and the route doesn't match, yielding a 404/4xx.
### What you think should happen instead?
The task should succeed and XComs should be written even when dictionary keys contain "/" (either by accepting "/" in the server route, or by safe-encoding/sanitizing keys on client/server consistently). At minimum, the behavior should be documented or validated early with a clear error if "/" in keys is unsupported.
### How to reproduce
````python
from airflow.decorators import dag, task
@dag(schedule=None)
def xcom_slash_key_bug():
@task
def this_works() -> dict[str, str]:
return {"Some Key": "Some Value"}
@task
def this_works_as_well() -> str:
return "/some/path/like/key"
@task
def this_does_not_work() -> dict[str, str]:
return {"key with slash /": "Some Value"}
this_works() >> this_works_as_well() >> this_does_not_work()
dag = xcom_slash_key_bug()
````
### Operating System
Docker image
### Versions of Apache Airflow Providers
_No response_
### Deployment
Other Docker-based deployment
### Deployment details
_No response_
### Anything else?
Log output:
````
[2025-09-09, 08:33:14] INFO - Done. Returned value was: {'/some/path/like/key': 'Some Value'}: source="airflow.task.operators.airflow.providers.standard.decorators.python._PythonDecoratedOperator"
[2025-09-09, 08:33:14] INFO - Pushing xcom: ti="RuntimeTaskInstance(id=UUID('01992d2d-836b-716c-b17d-03be4ec4c67a'), task_id='this_does_not_work', dag_id='testing', run_id='manual__2025-09-09T06:33:01.531829+00:00', try_number=1, map_index=-1, hostname='e7e821981d6d', context_carrier={}, task=<Task(_PythonDecoratedOperator): this_does_not_work>, bundle_instance=LocalDagBundle(name=dags-folder), max_tries=0, start_date=datetime.datetime(2025, 9, 9, 6, 33, 11, 94959, tzinfo=TzInfo(UTC)), end_date=None, state=<TaskInstanceState.RUNNING: 'running'>, is_mapped=False, rendered_map_index=None, log_url='https://airflow.damas.pilatus-aircraft.com/dags/testing/runs/manual__2025-09-09T06%3A33%3A01.531829%2B00%3A00/tasks/this_does_not_work?try_number=1')": source="task"
[2025-09-09, 08:33:14] ERROR - Task failed with exception: source="task"
AirflowRuntimeError: API_SERVER_ERROR: {'status_code': 404, 'message': 'Not Found', 'detail': {'detail': 'Not Found'}}
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py", line 931 in run
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py", line 1275 in _push_xcom_if_needed
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py", line 414 in xcom_push
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py", line 561 in _xcom_push
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/bases/xcom.py", line 84 in set
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py", line 204 in send
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py", line 264 in _get_response
File "/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/comms.py", line 251 in _from_frame
````
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3 [airflow]
Posted by "sdg9670 (via GitHub)" <gi...@apache.org>.
sdg9670 commented on issue #55410:
URL: https://github.com/apache/airflow/issues/55410#issuecomment-3277300501
I see same error, when worker starts.
The task has long op_args, so I set the config `AIRFLOW__CORE__MAX_TEMPLATED_FIELD_LENGTH` as big thet There's no error about trunacted render template.
### Worker log
```
{
"timestamp": "2025-09-11T03:24:50.396782Z",
"level": "warning",
"event": "Server error",
"detail": {
"detail": {
"reason": "not_found",
"message": "Task Instance not found"
}
},
"logger": "airflow.sdk.api.client"
}
```
### API Server log (masking *)
```
2025-09-11 03:42:22 [debug ] Starting task instance run hostname=* pid=40 ti_id=* unixname=airflow
2025-09-11 03:42:22 [error ] Task Instance not found ti_id=*
INFO: 172.31.248.46:42414 - "PATCH /execution/task-instances/*/run HTTP/1.1" 404 Not Found
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3 [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #55410:
URL: https://github.com/apache/airflow/issues/55410#issuecomment-3270770059
@Prasanth345, please feel free to open up a PR for this issue. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3 [airflow]
Posted by "Prasanth345 (via GitHub)" <gi...@apache.org>.
Prasanth345 commented on issue #55410:
URL: https://github.com/apache/airflow/issues/55410#issuecomment-3269853279
Hi, I would like to work on this issue, could you please assign it to me?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3 [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun closed issue #55410: Execution API / XCom push fails when TaskFlow returns dict with a key containing "/" (slash) in Airflow 3
URL: https://github.com/apache/airflow/issues/55410
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org