linkedErrors limit is not applied to AggregateError / SuppressedError children
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
11.9.0 (also checked current develop)
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
const Sentry = require('@sentry/node');
Sentry.init({
dsn: 'https://[email protected]/0',
// default linkedErrorsIntegration limit is 5
});
const children = Array.from({ length: 20 }, (_, i) => new Error(`child-${i}`));
Sentry.captureException(new AggregateError(children, 'group'));
Steps to Reproduce
- Capture an
AggregateErrorwhoseerrorsarray is longer than the linked-errorslimit(default 5). - Inspect
event.exception.values(or the event in Sentry).
The same pattern applies to a long SuppressedError chain via the error / suppressed properties.
In packages/core/src/utils/aggregate-errors.ts, the limit check runs at the start of each recursive call, but the AggregateError.errors and SuppressedError loops still walk every child and prepend each one before that check can stop the walk. Cause chains via key (usually cause) do get capped.
I opened https://github.com/getsentry/sentry-javascript/pull/25767 without an issue first and it was closed — filing here as requested before any further PR.
Expected Result
At most limit + 1 exceptions in event.exception.values (the root plus up to limit linked ones), including when the extras come from AggregateError.errors or SuppressedError.
Actual Result
Every AggregateError child (and every SuppressedError sibling) is turned into an exception. With 20 children and the default limit of 5, you get far more than 6 values.
Happy to open a PR once a maintainer confirms this is wanted.
Hey @CheckPickerUpper, thanks for reporting! The fix will be included in our next release.
A PR closing this issue has just been released 🚀
This issue was referenced by PR #25873, which was included in the 11.11.0 release.