jerryqhyu opened a new issue, #41596: URL: https://github.com/apache/airflow/issues/41596
### Apache Airflow version 2.9.3 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? When the same task group gets called multiple times within a task group, a `airflow.exceptions.DuplicateTaskIdFound` is raised. See `print_k_group_inner` in the following example. Note that if you comment out one of the `print_k_group_inner`, the top-level task gorup is named correctly to `print_k_group` and `print_k_group__1`. ### What you think should happen instead? There should be 4 task groups created and no errors raised. -`print_k_group.print_k_group_inner` -`print_k_group.print_k_group_inner__1` -`print_k_group__1.print_k_group_inner` -`print_k_group__1.print_k_group_inner__1` ### How to reproduce `from airflow.decorators import dag, task_group, task from pendulum import datetime @dag( start_date=datetime(2023, 7, 1), schedule=None, catchup=False, tags=["@task_group", "dependencies"], ) def test_tg(): @task def get_k(): return 10 @task def print_k(k): print(k) @task_group def print_k_group(k): print_k_group_inner(k) print_k_group_inner(k) @task_group def print_k_group_inner(k): print_k(k) k = get_k() print_k_group(k) print_k_group(k) test_tg() ` ### Operating System Ubuntu 22.04.4 LTS ### Versions of Apache Airflow Providers None ### 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: commits-unsubscr...@airflow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org