DonHaul opened a new issue, #56953:
URL: https://github.com/apache/airflow/issues/56953

   ### Apache Airflow version
   
   Other Airflow 2/3 version (please specify below)
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   3.0.6
   
   ### What happened?
   
   
   I have a simple dag where one map task depends on a single task:
   
   when running `airlfow task tests`:
   ```bash
   airflow tasks test problem_dag multiply_by_two  --map-index 0  -t 
'{"number":2}'
   ```
   I get an error saying that  the xcoms for `get_numbers` is not found so its 
defaulting to None, even thought I am testing `multiply_by_two` and provide 
params for it.
   ```bash
   2025-10-21 13:51:54 [error    ] XCom not found                 
[airflow.sdk.api.client] dag_id=problem_dag detail={'detail': {'reason': 
'not_found', 'message': "XCom with key='return_value' map_index=-1 not found 
for task 'get_numbers' in DAG run 
'__airflow_temporary_run_2025-10-21T13:51:52.789707+00:00__' of 
'problem_dag'"}} key=return_value map_index=None 
run_id=__airflow_temporary_run_2025-10-21T13:51:52.789707+00:00__ 
status_code=404 task_id=get_numbers
   2025-10-21 13:51:54 [warning  ] No XCom value found; defaulting to None. 
[task] dag_id=problem_dag key=return_value map_index=None 
run_id=__airflow_temporary_run_2025-10-21T13:51:52.789707+00:00__ 
task_id=get_numbers
   ```
   which than fails 
   
   ```bash
   │ 
/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/definitions/xcom_arg.py:596
 in _   │
   │                                                                            
                      │
   │   593 │   if xcom_arg.operator.is_mapped:                                  
                      │
   │   594 │   │   # TODO: How to tell if all the upstream TIs finished?        
                      │
   │   595 │   │   pass                                                         
                      │
   │ ❱ 596 │   return (upstream_map_indexes.get(task_id) or 1) * 
len(resolved_val)     
   ```
   with
   ```
   TypeError: object of type 'NoneType' has no len()
   ```
   
   The full logs can be found here:
   [log.txt](https://github.com/user-attachments/files/23022615/log.txt)
   
   
   
   ### What you think should happen instead?
   
   When running
   
   ```bash
   airflow tasks test problem_dag multiply_by_two  --map-index 0  -t 
'{"number":2}'
   ```
   Since all the parameters required , it should either:
   - not try to fetch the xcoms from `get_numbers()`
   - run `get_numbers()` before it fetches its `xcoms`
   
   ### How to reproduce
   
   Run
   
   ```bash
   airflow tasks test problem_dag multiply_by_two  --map-index 0  -t 
'{"number":2}'
   ```
   
   for dag
   ```python
   from airflow.decorators import dag, task
   
   @dag
   def problem_dag():
       @task
       def get_numbers(**context):
           return [1,2]
   
       @task
       def multiply_by_two(number, **context):
           return number * 2
   
   
       numbers = get_numbers()
       multiplied_numbers = multiply_by_two.expand(number=numbers)
   
   problem_dag()
   ```
   
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### 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]

Reply via email to