robertorobles opened a new pull request, #73201:
URL: https://github.com/apache/airflow/pull/73201
closes: #73175
### Description
`TaskInstance.xcom_pull()` from within a running task goes through
`airflow.sdk.api.client.py::XComOperations.get()` (and `get_sequence_item()`).
When the requested key/task_id has no matching XCom, the API server returns a
`404`, which is caught and handled gracefully: the call returns `None`,
matching Airflow 2.x behavior, and no exception propagates to the task.
Before returning, though, this was logged at `ERROR` level:
```python
log.error(
"XCom not found",
dag_id=dag_id, run_id=run_id, task_id=task_id, key=key,
map_index=map_index, detail=e.detail, status_code=e.response.status_code,
)
```
This means any task using the common, valid pattern of pulling an optional
upstream XCom (e.g. with a `default`, or just checking whether something was
pushed) emits a task-log `ERROR` even though nothing failed. This is confusing
for monitoring/alerting setups that key off ERROR-level task logs, and
misrepresents an expected, already-handled condition as an error.
This behavior was introduced in #45344 (closing #45341), which fixed a real
bug — the task crashing entirely on a missing XCom — by catching the 404 and
returning `None`. That PR's discussion focused on not crashing; the log level
itself wasn't discussed.
### Change
Downgrade the two `"XCom not found"` `log.error(...)` calls in
`XComOperations.get()` and `XComOperations.get_sequence_item()` to
`log.warning(...)`. No behavior change — the call still returns `None`/an
`ErrorResponse` as before, only the log level changes.
Scope is intentionally limited to these two XCom call sites (as opposed to
also touching the unrelated `"Asset not found"` log in the same file), to keep
this focused and easy to review.
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
--
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]