Skip to content

.

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

ref(anthropic): Factor out streamed result handling #5563

.
6cdab16
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: code-review completed Feb 27, 2026 in 1m 7s

1 issue

code-review: Found 1 issue (1 medium)

Medium

Missing null check for integration in streaming response handler could cause AttributeError - `sentry_sdk/integrations/anthropic.py:402`

The new _patch_streaming_response_iterator function fetches integration via sentry_sdk.get_client().get_integration(AnthropicIntegration) at line 402, but doesn't check if it's None before passing it to _set_output_data. If the client configuration changes or gets disabled between when the original call started and when the stream is consumed, integration could be None, causing an AttributeError when _set_output_data accesses integration.include_prompts at line 358.

Also found at:

  • sentry_sdk/integrations/anthropic.py:514-516

Duration: 1m 5s · Tokens: 194.4k in / 2.8k out · Cost: $0.32 (+extraction: $0.00, +merge: $0.00)

Annotations

Check warning on line 402 in sentry_sdk/integrations/anthropic.py

See this annotation in the file changed.

@github-actions github-actions / warden: code-review

Missing null check for integration in streaming response handler could cause AttributeError

The new `_patch_streaming_response_iterator` function fetches `integration` via `sentry_sdk.get_client().get_integration(AnthropicIntegration)` at line 402, but doesn't check if it's `None` before passing it to `_set_output_data`. If the client configuration changes or gets disabled between when the original call started and when the stream is consumed, `integration` could be `None`, causing an `AttributeError` when `_set_output_data` accesses `integration.include_prompts` at line 358.

Check warning on line 516 in sentry_sdk/integrations/anthropic.py

See this annotation in the file changed.

@github-actions github-actions / warden: code-review

[RK8-6U8] Missing null check for integration in streaming response handler could cause AttributeError (additional location)

The new `_patch_streaming_response_iterator` function fetches `integration` via `sentry_sdk.get_client().get_integration(AnthropicIntegration)` at line 402, but doesn't check if it's `None` before passing it to `_set_output_data`. If the client configuration changes or gets disabled between when the original call started and when the stream is consumed, `integration` could be `None`, causing an `AttributeError` when `_set_output_data` accesses `integration.include_prompts` at line 358.