Skip to content

.

d47b64d
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

ref(anthropic): Skip accumulation logic for unexpected types in streamed response #5564

.
d47b64d
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden completed Feb 27, 2026 in 2m 31s

2 issues

High

Import logic will cause ImportError on newer anthropic SDK versions - `sentry_sdk/integrations/anthropic.py:57-64`

Lines 57-64 unconditionally import non-Raw types (MessageStartEvent, etc.) after attempting to import Raw types. According to the referenced anthropic SDK commit, newer versions of the SDK renamed these types to have the "Raw" prefix. If the Raw* imports succeed (lines 46-53), the non-Raw imports (lines 57-64) will fail with ImportError since those types no longer exist in newer SDK versions. This will cause the Sentry SDK to fail initialization with 'DidNotEnable: Anthropic not installed'.

Also found at:

  • sentry_sdk/integrations/anthropic.py:435-458
  • sentry_sdk/integrations/anthropic.py:500-523
NameError when Raw* types fail to import but are still referenced in isinstance checks - `sentry_sdk/integrations/anthropic.py:43-55`

When the RawMessageStartEvent, RawMessageDeltaEvent, etc. imports fail (line 54-55), message_types_have_raw_prefix is set to True, but the Raw* type names remain undefined. However, when message_types_have_raw_prefix is True, the code path in new_iterator() (lines 436-447) and new_iterator_async() (lines 500-512) evaluates isinstance(event, (RawMessageStartEvent, ...)), causing a NameError at runtime.

Also found at:

  • sentry_sdk/integrations/anthropic.py:435-447
  • sentry_sdk/integrations/anthropic.py:500-523
4 skills analyzed
Skill Findings Duration Cost
code-review 1 2m 4s $0.42
find-bugs 1 2m $0.41
skill-scanner 0 50.8s $0.25
security-review 0 48.6s $0.29

Duration: 5m 44s · Tokens: 403.5k in / 13.6k out · Cost: $1.40 (+extraction: $0.03, +merge: $0.00, +dedup: $0.00)