Repository navigation
fix(core): Handle callback errors - #6140
Merged
Merged
Conversation
📲 Install BuildsAndroid
|
Add the callback_error discard reason and use it when a beforeSend callback throws. Preserve before_send for callbacks that intentionally return null and retain item, span, and byte accounting. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
6 of 9 tasks
Stop processing and drop telemetry when an event processor throws. Record callback_error outcomes for every supported category instead of sending potentially partially processed data. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
5 of 9 tasks
Drop breadcrumbs when beforeBreadcrumb throws instead of storing the breadcrumb with exception details. Keep observer state unchanged and release the callback reentrancy guard for later additions. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
5 of 9 tasks
Add an internal marker to SDK event processors across core and integrations. Keep customer processors and the backfilling marker independent so later callback handling can distinguish ownership regardless of registration path. Leave exception handling unchanged in this preparatory change. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
Make the preceding marker PR available to the processor failure policy. Preserve the existing stack commits and leave failure behavior unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
Carry the inserted SDK processor marker forward through the adjacent stack branch without rewriting existing history or changing breadcrumb behavior. Co-Authored-By: Claude <noreply@anthropic.com>
Use the internal processor marker to continue processing after SDK-owned processor failures without recording callback_error losses. Keep customer processor failures fail-closed across events, transactions, replays, feedback, logs, and metrics. Cover scope and options registration, continued callbacks and delivery, logging without discard notifications, intentional drops, and span loss accounting. Clarify the customer-only failure policy in the changelog. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
Inherit the parent sampling decision when tracesSampler throws. Without a parent decision, leave the trace unsampled instead of applying the static tracesSampleRate, which can override the failed sampling policy. Keep normal null-result fallback, profiling callbacks, and catch types unchanged. Cover parent inheritance, backfilling, and static-rate bypass. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
Disable profiling when profilesSampler throws instead of applying the static profilesSampleRate or inheriting a parent profiling decision. Preserve trace sampling metadata and normal null-result fallback. Cover static-rate bypass, parent inheritance, and failures in both samplers without changing existing catch types. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
Skip replay capture when beforeErrorSampling throws instead of capturing replay after a failed user filter. Continue sending the error event and retain existing exception logging and catch types. Cover handled errors, crashes, and successful replay capture after a previous callback failure. Verify error delivery and failure logging. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
Record callback_error/profile when beforeSendTransaction or a customer transaction processor throws and an attached profile is dropped. Notify OnDiscardCallback through the same client-report accounting path. Cover scope and options processors, absent profiles, and SDK processor failures that retain profiles. Leave catch types, intentional drops, and profile-file cleanup unchanged. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
Skip Android screenshot and view hierarchy capture when their callbacks throw, while retaining the error event. Drop spans on beforeSpan failures in OkHttp, OpenFeign, GraphQL, Ktor, and Apollo without disrupting requests or replacing the original request error. Preserve normal callback results and existing catch types. Finish failed spans and retain request cleanup and breadcrumbs. Add regression coverage for callback failures, partial mutations, original request errors, asynchronous GraphQL results, and subsequent Android captures. Correct callback wiring in the Ktor and screenshot test fixtures. Verify 18 regression cases fail before the fix and pass afterward; all 454 tests in the affected suites pass, along with formatting and API checks. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
4 of 9 tasks
…ndling-user-feedback
…ndling-spring-user-provider
…ndling-spring-transaction-name-provider
…pollo-5 fix(apollo5): Handle beforeSpan callback failures
Identify which SentryUserProvider failed when multiple providers are configured, making callback failures actionable across all Spring variants. Refs GH-6240 Co-Authored-By: Claude <noreply@anthropic.com>
…ndling-spring-user-provider
…pring-user-provider fix(spring): Handle user provider failures
Ensure a failed legacy configuration does not prevent the configurator from receiving the original feedback options and applying its changes. Co-Authored-By: Claude <noreply@anthropic.com>
Ensure fatal errors from the feedback options configurator are rethrown instead of being handled as recoverable callback failures. Co-Authored-By: Claude <noreply@anthropic.com>
…ndling-user-feedback
…ndling-spring-transaction-name-provider
…ser-feedback fix(android): Handle feedback configurator failures
…ndling-spring-transaction-name-provider
…pring-transaction-name-provider fix(spring): Handle transaction name provider failures
adinauer
marked this pull request as ready for review
October 13, 2026 08:13
adinauer
requested review from
0xadam-brown,
markushi,
romtsn and
runningcode
as code owners
October 13, 2026 08:13
Move the callback error handling entry back to Unreleased and group the related changes by impact so the full behavior change is documented in one place. Co-Authored-By: Claude <noreply@anthropic.com>
Catch nonfatal Throwable failures from newly guarded customer callbacks while continuing to propagate fatal JVM errors. This keeps callback isolation consistent without introducing new fatal-error swallowing. Add regression coverage for nonfatal fallback behavior and fatal error propagation across the affected integrations. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
…o fix/callback-error-handling-nonfatal-throwables
6 of 9 tasks
Keep Apollo 2's existing Exception boundary unchanged so non-Exception errors retain their released behavior. Limit the broader nonfatal Throwable handling to callback guards introduced by the unreleased stack. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
* fix(callbacks): Handle nonfatal callback throwables Catch nonfatal Throwable failures from newly guarded customer callbacks while continuing to propagate fatal JVM errors. This keeps callback isolation consistent without introducing new fatal-error swallowing. Add regression coverage for nonfatal fallback behavior and fatal error propagation across the affected integrations. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com> * changelog * fix(callbacks): Preserve Apollo 2 error handling Keep Apollo 2's existing Exception boundary unchanged so non-Exception errors retain their released behavior. Limit the broader nonfatal Throwable handling to callback guards introduced by the unreleased stack. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Callback Errors)
📜 Description
Collects the callback error handling PR stack. The collection branch intentionally contains only an empty commit; the implementation lands through the stacked PRs below it.
💡 Motivation and Context
Filtering callback failures must not allow potentially partially processed telemetry to continue through the pipeline. This stack distinguishes callback failures in client reports and consistently drops affected telemetry or breadcrumbs.
💚 How did you test it?
The cumulative stack passes focused
sentrytests forSentryClientTest,ScopeTest,ScopesTest, andClientReportTest, plus:sentry:apiCheck.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Merge the stack PRs bottom to top using merge commits, then squash-merge this collection PR into
main.