Skip to content

fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function - #6253

Open
mujacica wants to merge 7 commits into
masterfrom
fix/switch-events
Open

fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function#6253
mujacica wants to merge 7 commits into
masterfrom
fix/switch-events

Conversation

@mujacica

@mujacica mujacica commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Switch crash events are titled with Nintendo's raw abort result code (e.g. 2168-0002 ResultAccessViolationData), hiding the crashing function and burying real regressions in a sea of identical-looking titles (getsentry/sentry-switch#153).

This PR marks the exception synthetic, the same treatment minidumps get via write_native_placeholder, so Sentry falls back to the symbolicated crashing function for the title. The result code stays queryable on exception.type and the mechanism tag. It also re-asserts level: fatal — Nintendo forwards crashes as fatal, but the DyingMessage scope patch is the merge base and downgrades it to error — and hardens dying-message parsing against a panic on payloads shorter than the magic number.

Validated end-to-end against a real CRPortal-forwarded crash (captured by pointing a CRPortal Import Destination at a local Relay in processing mode): before → title 2168-0002 ResultAccessViolationData: …, after → title nnMain, level fatal. Details on the original issue.


Event before fix:
https://sentry-sdks.sentry.io/issues/7671819961/?project=4509910938550273&query=is%3Aunresolved&referrer=issue-stream&sort=recommended

Event after fix:
https://sentry-sdks.sentry.io/issues/7671893807/?project=4509910938550273&query=is%3Aunresolved&referrer=issue-stream&sort=recommended

mujacica added 3 commits July 22, 2026 10:57
The native crash helpers are only compiled with the processing feature
(pub use self::native::* is cfg-gated), so calling reshape_switch_crash
unconditionally broke the default-features build (E0425). Wrap the call
in if_processing! like the minidump path, and guard the now-conditional
mut binding.
Comment thread relay-server/src/processing/errors/errors/nswitch.rs
…cking

Item::attachment_type can return NintendoSwitchDyingMessage from an
explicitly set item header, bypassing the starts_with(magic) guard used
when inferring the type. expand_dying_message then called Bytes::advance
past the payload length, which panics and crashes the processing worker
(DoS). Validate the magic up front and return an error instead.

Reported by Warden wrdn-dos-review.
Comment on lines +522 to +526
let envelope = r#"{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","dsn":"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42"}
{"type":"event"}
{"level":"error","exception":{"values":[{"type":"2168-0002 ResultAccessViolationData","value":"Data access to an invalid memory region was performed. (2: Access Violation Data)","stacktrace":{"frames":[{"function":"ASentryTowerTurret::Shoot"}]}}]}}
{"type":"attachment","filename":"dying_message.dat","length":<len>}
"#

@JoshuaMoelans JoshuaMoelans Aug 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: we have this "fake" json envelope constructed here, but we could add a test with an actual captured one from our switch-SDK integration tests. Not sure if this is somehow not advised?

A raw capture of what CRPortal actually delivers (via an Import
Destination pointed at a local Relay) showed the forwarded event already
carries mechanism.handled: false and level: fatal. The error level seen
on stored events comes from the DyingMessage scope patch winning the
merge, not from Nintendo.

Remove the redundant handled write and correct the reshape docs, test
premise, and changelog accordingly: synthetic remains the title fix, and
the level write re-asserts the severity the merge downgraded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JoshuaMoelans JoshuaMoelans changed the title fix(switch): Match the event types of other console/gaming errors fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function Aug 14, 2026
@JoshuaMoelans
JoshuaMoelans marked this pull request as ready for review August 14, 2026 14:44
@JoshuaMoelans
JoshuaMoelans requested a review from a team as a code owner August 14, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants