Repository navigation
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 Version
Vue 2.7 + React 18
Link to Sentry event
Not public. The event payload is quoted under "Actual Result".
Reproduction Example/SDK Setup
Default browser integrations (GlobalHandlers and LinkedErrors are on). Nothing else is needed.
Steps to Reproduce
Throw an error that has a cause, with no catch anywhere:
setTimeout(() => {
throw new Error('outer', { cause: new Error('inner') });
});The error reaches window.onerror, and globalHandlersIntegration sends it with mechanism: { handled: false, type: 'auto.browser.global_handlers.onerror' }.
Expected Result
The issue shows handled: no, because no code handled the error.
Actual Result
The issue shows handled: yes. The handled: false mechanism ends up on the cause, and the top-level exception keeps a default handled: true:
exception.values[0] Error "inner" {"type":"auto.browser.global_handlers.onerror","handled":false,"source":"cause","exception_id":1,"parent_id":0}
exception.values[1] Error "outer" {"handled":true,"type":"auto.core.linked_errors","exception_id":0}
The issue title and the handled tag come from values[1] ("outer"), so the UI says handled.
Why it happens
Two steps in Client._prepareEvent run in this order:
this.emit('preprocessEvent', event, hint)runslinkedErrorsIntegration.applyAggregateErrorsToEventputs the cause in front ofexception.valuesand gives the parent{ handled: true, type: 'auto.core.linked_errors' }(utils/aggregate-errors.js,applyExceptionGroupFieldsForParentException).prepareEvent()then applieshint.mechanismwithaddExceptionMechanism(prepared, hint.mechanism)(utils/prepareEvent.js).addExceptionMechanismonly changesgetFirstException(event), which isvalues[0], and after step 1 that is the cause.
Per #6073 and #17212, errors captured by SDK auto-instrumentation should be handled: false, so this looks unintended.
Impact
Any 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.
Possible fixes
- Apply
hint.mechanismbeforepreprocessEvent, or - When the event has been aggregated, have
addExceptionMechanismtarget the top-level exception (values[values.length - 1]) instead ofvalues[0].
Node reproduction of the same capture path
const Sentry = require('@sentry/browser');
const { eventFromUnknownInput } = require('@sentry/browser/build/npm/cjs/prod/eventbuilder.js');
const client = new Sentry.BrowserClient({
dsn: 'https://public@o0.ingest.sentry.io/0',
stackParser: Sentry.defaultStackParser,
integrations: [Sentry.linkedErrorsIntegration()],
transport: () => ({ send: async () => ({}), flush: async () => true }),
beforeSend(event) {
for (const v of event.exception.values) console.log(v.type, v.value, JSON.stringify(v.mechanism));
return null;
},
});
Sentry.setCurrentClient(client);
client.init();
// Same call globalHandlersIntegration makes on window.onerror
const err = new Error('outer', { cause: new Error('inner') });
Sentry.captureEvent(eventFromUnknownInput(Sentry.defaultStackParser, err, undefined, false, false), {
originalException: err,
mechanism: { handled: false, type: 'auto.browser.global_handlers.onerror' },
});Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Nov 1, 2026
JS-4054
darshpatel1052 commentedon Nov 3, 2026
Hi, I’d like to take this on. I’d reproduce the linked-cause capture path, check where hint.mechanism is applied after aggregation, and add coverage for uncaught, handled and aggregate errors. Is targeting the root exception the preferred fix, or should the mechanism be attached before linked-error processing?
andreiborza commentedon Nov 4, 2026
Hi @jungho1000, thanks for filing this. We fixed this bug in v11, I suggest to upgrade to it following our migration guide. In the meantime, we will backport the fix to v10.
@darshpatel1052 thank you for the offer, but since this has already been fixed we will simply backport it.
fix(v10/core): Apply capture mechanism to originally captured excepti…