Skip to content

fix(client): Normalize span description whitespace before before_send…

e804242
Select commit
Loading
Failed to load commit list.
Merged

ref(asyncpg): Normalize query whitespace in integration #5855

fix(client): Normalize span description whitespace before before_send…
e804242
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 24, 2026 in 3m 13s

1 issue

find-bugs: Found 1 issue (1 high)

High

TypeError crash when span description is None - `sentry_sdk/client.py:718-719`

The _clean_span_descriptions method checks if "description" in s: which only verifies the key exists, not that its value is non-None. When s["description"] is None (which is valid per the span serialization at tracing.py:702), calling re.sub(r"\s+", " ", s["description"]) raises TypeError: expected string or bytes-like object, got 'NoneType'. Since this code runs outside capture_internal_exceptions(), the error will propagate and could crash transaction processing.


Duration: 3m 12s · Tokens: 977.3k in / 8.5k out · Cost: $1.39 (+extraction: $0.00, +fix_gate: $0.00)

Annotations

Check failure on line 719 in sentry_sdk/client.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

TypeError crash when span description is None

The `_clean_span_descriptions` method checks `if "description" in s:` which only verifies the key exists, not that its value is non-None. When `s["description"]` is `None` (which is valid per the span serialization at `tracing.py:702`), calling `re.sub(r"\s+", " ", s["description"])` raises `TypeError: expected string or bytes-like object, got 'NoneType'`. Since this code runs outside `capture_internal_exceptions()`, the error will propagate and could crash transaction processing.