vatsrahul1001 opened a new issue, #46417: URL: https://github.com/apache/airflow/issues/46417
### Apache Airflow version 3.0.0a1 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? ` pulled_value_1 = ti.xcom_pull(key=None, task_ids="push")` in failing in AF3, however, same code works with `2.10.4`. Looks like when I provide the key it works fine. I am raising this issue as there is a deviation of behaviour from AF2 here. Maybe we can handle this in task-sdk **3.0.0a1** <img width="1525" alt="Image" src="https://github.com/user-attachments/assets/b79e2124-43c3-4e98-a715-a5da7e55e0e4" /> **2.10.4** <img width="1388" alt="Image" src="https://github.com/user-attachments/assets/b7006021-4179-402d-a639-8d42388bd9fc" /> `{"timestamp":"2025-02-04T11:01:20.886364","level":"error","event":"Task failed with exception","logger":"task","error_detail":[{"exc_type":"ValidationError","exc_value":"1 validation error for GetXCom\nkey\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit [https://errors.pydantic.dev/2.10/v/string_type","syntax_error":null,"is_cause":false,"frames":[](https://errors.pydantic.dev/2.10/v/string_type%22,%22syntax_error%22:null,%22is_cause%22:false,%22frames%22:[){"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":545,"name":"run"},{"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":645,"name":"_execute_task"},{"filename":"/opt/airflow/airflow/models/baseoperator.py","lineno":173,"name":"wrapper"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":196,"name":"execute"},{"filena me":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":222,"name":"execute_callable"},{"filename":"/opt/airflow/airflow/utils/operator_helpers.py","lineno":261,"name":"run"},{"filename":"/files/dags/example_xcom.py","lineno":34,"name":"puller"},{"filename":"/opt/airflow/task_sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":266,"name":"xcom_pull"},{"filename":"/usr/local/lib/python3.9/site-packages/pydantic/main.py","lineno":214,"name":"__init__"}]}]} ` ### What you think should happen instead? Same code working in AF2 should work in AF3 as well ### How to reproduce Use below DAG to replicate **DAG CODE** ``` """Example DAG demonstrating the usage of XComs.""" from airflow import DAG from airflow.providers.standard.operators.python import PythonOperator from datetime import datetime, timedelta dag = DAG( "example_xcom", start_date=datetime(2023, 11, 28), default_args={"owner": "airflow"}, schedule="@daily", catchup=False, tags=["core"], ) value_1 = [1, 2, 3] value_2 = {"a": "b"} def push(**kwargs): """Pushes an XCom without a specific target""" kwargs["ti"].xcom_push(key="value from pusher 1", value=value_1) def push_by_returning(**kwargs): """Pushes an XCom without a specific target, just by returning it""" return value_2 def puller(**kwargs): """Pull all previously pushed XComs and check if the pushed values match the pulled values.""" ti = kwargs["ti"] # get value_1 pulled_value_1 = ti.xcom_pull(key=None, task_ids="push") if pulled_value_1 != value_1: raise ValueError(f"The two values differ {pulled_value_1} and {value_1}") # get value_2 pulled_value_2 = ti.xcom_pull(task_ids="push_by_returning") if pulled_value_2 != value_2: raise ValueError(f"The two values differ {pulled_value_2} and {value_2}") # get both value_1 and value_2 pulled_value_1, pulled_value_2 = ti.xcom_pull( key=None, task_ids=["push", "push_by_returning"] ) print(f"pulled_value_1 is {pulled_value_1}") print(f"pulled_value_2 is {pulled_value_2}") if pulled_value_1 != value_1: raise ValueError(f"The two values differ {pulled_value_1} and {value_1}") if pulled_value_2 != value_2: raise ValueError(f"The two values differ {pulled_value_2} and {value_2}") push1 = PythonOperator( task_id="push", dag=dag, python_callable=push, depends_on_past=True, ) push2 = PythonOperator( task_id="push_by_returning", dag=dag, python_callable=push_by_returning, ) pull = PythonOperator( task_id="puller", dag=dag, python_callable=puller, ) pull << [push1, push2] ``` ### Operating System Linux ### Versions of Apache Airflow Providers _No response_ ### Deployment Other ### 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]
