Sanjays2402 opened a new issue, #73714:
URL: https://github.com/apache/airflow/issues/73714
`airflow.utils.helpers.merge_dicts` documents: "Items in dict2 overwrite
those also found in dict1." But when a key exists in both dicts and dict2's
value is a dict while dict1's value is a scalar, it recurses unconditionally:
```python
from airflow.utils.helpers import merge_dicts
merge_dicts({'a': 1}, {'a': {'b': 2}})
# AttributeError: 'int' object has no attribute 'copy'
```
Line 177 checks `isinstance(v, dict)` but never checks that `merged[k]` is
also a dict before recursing into `merge_dicts(merged.get(k, {}), v)`, which
calls `dict1.copy()` on the scalar.
Expected: `{'a': {'b': 2}}` (dict2's value wins, per the docstring).
This is reachable in practice: `airflow/utils/log/json_formatter.py:57`
calls `merge_dicts(record_dict, self.extras)`, so a user-configured log extra
that collides with a scalar log-record attribute under the same name crashes
log formatting.
Seen on main at `8dff0303` (2026-09-25).
--
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]