feat(asgi): Migrate away from event processor in span first #5920
1 issue
find-bugs: Found 1 issue (1 high)
High
Return value contract mismatch: _get_request_attributes returns dict but caller unpacks as tuples - `sentry_sdk/integrations/_asgi_common.py:111-137`
The function _get_request_attributes returns a dict[str, Any]. However, in asgi.py line 310, the return value is used as for attribute, value in _get_request_attributes(scope):. Iterating over a dict directly yields only keys, not key-value pairs, causing a ValueError when trying to unpack a single key into two variables (attribute, value). This will crash the ASGI middleware at runtime whenever span streaming is not enabled.
Also found at:
sentry_sdk/integrations/asgi.py:18sentry_sdk/integrations/asgi.py:310-311
Duration: 2m 56s · Tokens: 667.9k in / 9.8k out · Cost: $1.26 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.00)
Annotations
Check failure on line 137 in sentry_sdk/integrations/_asgi_common.py
sentry-warden / warden: find-bugs
Return value contract mismatch: _get_request_attributes returns dict but caller unpacks as tuples
The function `_get_request_attributes` returns a `dict[str, Any]`. However, in `asgi.py` line 310, the return value is used as `for attribute, value in _get_request_attributes(scope):`. Iterating over a dict directly yields only keys, not key-value pairs, causing a `ValueError` when trying to unpack a single key into two variables (`attribute, value`). This will crash the ASGI middleware at runtime whenever span streaming is not enabled.
Check failure on line 18 in sentry_sdk/integrations/asgi.py
sentry-warden / warden: find-bugs
[NNE-MN5] Return value contract mismatch: _get_request_attributes returns dict but caller unpacks as tuples (additional location)
The function `_get_request_attributes` returns a `dict[str, Any]`. However, in `asgi.py` line 310, the return value is used as `for attribute, value in _get_request_attributes(scope):`. Iterating over a dict directly yields only keys, not key-value pairs, causing a `ValueError` when trying to unpack a single key into two variables (`attribute, value`). This will crash the ASGI middleware at runtime whenever span streaming is not enabled.
Check failure on line 311 in sentry_sdk/integrations/asgi.py
sentry-warden / warden: find-bugs
[NNE-MN5] Return value contract mismatch: _get_request_attributes returns dict but caller unpacks as tuples (additional location)
The function `_get_request_attributes` returns a `dict[str, Any]`. However, in `asgi.py` line 310, the return value is used as `for attribute, value in _get_request_attributes(scope):`. Iterating over a dict directly yields only keys, not key-value pairs, causing a `ValueError` when trying to unpack a single key into two variables (`attribute, value`). This will crash the ASGI middleware at runtime whenever span streaming is not enabled.