Title: Uncaught errors that have a `cause` show as `handled: yes` · Issue #25988 · getsentry/sentry-javascript · GitHub
Open Graph Title: Uncaught errors that have a `cause` show as `handled: yes` · Issue #25988 · getsentry/sentry-javascript
X Title: Uncaught errors that have a `cause` show as `handled: yes` · Issue #25988 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues How do you use Sentry? Sentry SaaS (sentry.io) Which SDK are you using? @sentry/vue (also reproduced with @sentry/browser alone) SDK Version 10.75.0 Framework Versio...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues How do you use Sentry? Sentry SaaS (sentry.io) Which SDK are you using? @sentry/vue (also reproduced with @sentry/browser alo...
X Description: Is there an existing issue for this? I have checked for existing issues How do you use Sentry? Sentry SaaS (sentry.io) Which SDK are you using? @sentry/vue (also reproduced with @sentry/browser alo...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25988
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Uncaught errors that have a `cause` show as `handled: yes`","articleBody":"### Is there an existing issue for this?\n- [x] I have checked for existing issues\n\n### How do you use Sentry?\nSentry SaaS (sentry.io)\n\n### Which SDK are you using?\n@sentry/vue (also reproduced with @sentry/browser alone)\n\n### SDK Version\n10.75.0\n\n### Framework Version\nVue 2.7 + React 18\n\n### Link to Sentry event\nNot public. The event payload is quoted under \"Actual Result\".\n\n### Reproduction Example/SDK Setup\n\nDefault browser integrations (GlobalHandlers and LinkedErrors are on). Nothing else is needed.\n\n### Steps to Reproduce\n\nThrow an error that has a `cause`, with no `catch` anywhere:\n\n```js\nsetTimeout(() => {\n throw new Error('outer', { cause: new Error('inner') });\n});\n```\n\nThe error reaches `window.onerror`, and `globalHandlersIntegration` sends it with `mechanism: { handled: false, type: 'auto.browser.global_handlers.onerror' }`.\n\n### Expected Result\n\nThe issue shows `handled: no`, because no code handled the error.\n\n### Actual Result\n\nThe issue shows `handled: yes`. The `handled: false` mechanism ends up on the cause, and the top-level exception keeps a default `handled: true`:\n\n```text\nexception.values[0] Error \"inner\" {\"type\":\"auto.browser.global_handlers.onerror\",\"handled\":false,\"source\":\"cause\",\"exception_id\":1,\"parent_id\":0}\nexception.values[1] Error \"outer\" {\"handled\":true,\"type\":\"auto.core.linked_errors\",\"exception_id\":0}\n```\n\nThe issue title and the `handled` tag come from `values[1]` (\"outer\"), so the UI says handled.\n\n### Why it happens\n\nTwo steps in `Client._prepareEvent` run in this order:\n\n1. `this.emit('preprocessEvent', event, hint)` runs `linkedErrorsIntegration`. `applyAggregateErrorsToEvent` puts the cause in front of `exception.values` and gives the parent `{ handled: true, type: 'auto.core.linked_errors' }` (`utils/aggregate-errors.js`, `applyExceptionGroupFieldsForParentException`).\n2. `prepareEvent()` then applies `hint.mechanism` with `addExceptionMechanism(prepared, hint.mechanism)` (`utils/prepareEvent.js`). `addExceptionMechanism` only changes `getFirstException(event)`, which is `values[0]`, and after step 1 that is the cause.\n\nPer #6073 and #17212, errors captured by SDK auto-instrumentation should be `handled: false`, so this looks unintended.\n\n### Impact\n\nAny uncaught error that has a `cause` is shown as handled. In our app the API client error always carries the underlying `AxiosError` as `cause`, so every uncaught API failure shows `handled: yes`, and searches or alerts on `handled` give wrong results.\n\n### Possible fixes\n\n- Apply `hint.mechanism` before `preprocessEvent`, or\n- When the event has been aggregated, have `addExceptionMechanism` target the top-level exception (`values[values.length - 1]`) instead of `values[0]`.\n\n### Node reproduction of the same capture path\n\n```js\nconst Sentry = require('@sentry/browser');\nconst { eventFromUnknownInput } = require('@sentry/browser/build/npm/cjs/prod/eventbuilder.js');\n\nconst client = new Sentry.BrowserClient({\n dsn: 'https://public@o0.ingest.sentry.io/0',\n stackParser: Sentry.defaultStackParser,\n integrations: [Sentry.linkedErrorsIntegration()],\n transport: () => ({ send: async () => ({}), flush: async () => true }),\n beforeSend(event) {\n for (const v of event.exception.values) console.log(v.type, v.value, JSON.stringify(v.mechanism));\n return null;\n },\n});\nSentry.setCurrentClient(client);\nclient.init();\n\n// Same call globalHandlersIntegration makes on window.onerror\nconst err = new Error('outer', { cause: new Error('inner') });\nSentry.captureEvent(eventFromUnknownInput(Sentry.defaultStackParser, err, undefined, false, false), {\n originalException: err,\n mechanism: { handled: false, type: 'auto.browser.global_handlers.onerror' },\n});\n```\n","author":{"url":"https://github.com/jungho1000","@type":"Person","name":"jungho1000"},"datePublished":"2026-11-01T23:24:29Z","url":"https://github.com/getsentry/sentry-javascript/issues/25988"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:875bdbe6-6dae-7bc0-60cd-5e88b275e41a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C30C:22716C:792637:A402FE:6B04CFE6 |
| html-safe-nonce | 5a19249a044da99a0bd785b6093b4f98419ff8b5797404b3fe243165d835323e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzBDOjIyNzE2Qzo3OTI2Mzc6QTQwMkZFOjZCMDRDRkU2IiwidmlzaXRvcl9pZCI6IjQzODI2NjU3NTM5NzYxNjQzMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e48b62f121414dfba22ea0b4ed7f81eb100cc4f6718d4818cfe6e12f941e8001 |
| hovercard-subject-tag | issue:6153361063 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25988/issue_layout |
| twitter:image | https://opengraph.githubassets.com/59cefe62d70e9f42683be065bbb766b77142f7cac229659a0019b73f4b2435dc/getsentry/sentry-javascript/issues/25988 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/59cefe62d70e9f42683be065bbb766b77142f7cac229659a0019b73f4b2435dc/getsentry/sentry-javascript/issues/25988 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues How do you use Sentry? Sentry SaaS (sentry.io) Which SDK are you using? @sentry/vue (also reproduced with @sentry/browser alo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jungho1000 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27ed421e5c2dac040a37529b5b9191edcc4a3de70521471e81fb4b4d9dc2aa7d |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63dc19014c621c67306d7899c04c78dcd0d95803 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width