SoinSoin opened a new issue, #56459: URL: https://github.com/apache/airflow/issues/56459
### Apache Airflow version 3.1.0 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? **Summary** --- Since Airflow 3.0 (tested on 3.0.6), it is impossible to use `expand` on a `@task_group` containing a task decorated with `@task.kubernetes_cmd`. Expansion works correctly for a standalone `@task.kubernetes_cmd` task, or for a `@task_group` containing a `@task.kubernetes` task, but fails in the specific case of a task group + `kubernetes_cmd`. The mapped data is not correctly interpreted or propagated. --- This code raises an error or does not correctly map the values to the internal TaskGroup task (`echo_cmd`). Note: If you replace `@task.kubernetes_cmd` with `@task.kubernetes`, it works as expected. --- **Expected behavior** - Expansion (`expand`) on a TaskGroup containing a `@task.kubernetes_cmd` task should work just like with other TaskFlow-compatible tasks. **Observed behavior** - The mapping/expand does not pass the expected values to the internal task within the TaskGroup. - The value injected into the internal task is a `MappedArgument` object (e.g., `<airflow.models.xcom_arg.MappedArgument object at ...>`) instead of the actual value (e.g. `"foo"`, `"bar"`). - There is no similar issue with `@task.kubernetes` in the same scenario. --- **Technical details** - When mapping via `expand` on a `@task_group` containing a `@task.kubernetes_cmd` task, the value received by the internal task is an unresolved `MappedArgument` object. --- **Environment** - Airflow: 3.0.6 - Deployment: via the official Helm chart ([apache/airflow](https://github.com/apache/airflow/tree/main/chart)) - Image used: `apache/airflow:3.0.6` - Python version: not explicitly set, using the official image default --- **Notes / leads** - It seems that expand/mapping on TaskGroups does not work with this specific decorator, while it does with others. - No existing issue found as of October 2025. --- **Thanks for your help and for all your great work on Airflow!** ### What you think should happen instead? _No response_ ### How to reproduce ```python from airflow.decorators import dag, task, task_group from datetime import datetime @dag(start_date=datetime(2023,1,1), schedule=None, catchup=False) def demo(): @task def make_values(): return ["foo", "bar", "baz"] @task.kubernetes_cmd(image="alpine") def echo_cmd(name): return ["echo", name] @task_group def group_task(name): echo_cmd(name) # This works: # echo_cmd.expand(name=make_values()) # This does NOT work: group_task.expand(name=make_values()) dag = demo() ``` ### Operating System apache/airflow:3.0.6 ### Versions of Apache Airflow Providers _No response_ ### Deployment Official Apache Airflow Helm Chart ### Deployment details _No response_ ### Anything else? _No response_ ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
