Conversation
Windows security software that intercepts TLS (corporate antivirus,
proxies) can make mailsync's HTTPS client throw an uncaught C++
exception while fetching an OAuth2 access token, crashing the process
with SEH code 0xE06D7363 (the MSVC runtime's "C++ exception" signature)
before it can log the usual {"offline":true} marker. This bypassed the
existing network-failure detection in _buildCrashError, so every
occurrence surfaced to users as an unhelpful "unknown error" message
and was reported to Sentry as an unactionable crash (MAILSPRING-CLIENT-DH,
~100 Windows users hitting this exact exit code while linking a new
Gmail/Outlook account).
Detect this specific crash fingerprint - the known SEH code plus a log
tail showing the process died fetching an OAuth2 token - and classify
it the same as the existing offline-marker case.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BfBhpanbqfLKX7csCsArzN
|
Important Indent Zero has shut down and no longer reviews pull requests.
Step 4 is only needed for pull requests that were already open when you switched. After that, Indent reviews new pull requests on its own. To stop this notice, turn PR reviews off in Indent Zero. |
|
Fixes https://foundry-376-llc.sentry.io/issues/MAILSPRING-CLIENT-DH
What I observed
MAILSPRING-CLIENT-DH is "An unknown error has occurred mailsync: 3765269347" — 116 users impacted, 240 events, all on Windows. Every single sampled event (25/25) has the identical shape:
...with mailsync exiting with code
3765269347, which is exactly0xE06D7363— the well-known Microsoft Visual C++ runtime SEH code that signals an uncaught C++ exception. This always happens intestmode, which is used byfinalizeAndValidateAccount()(app/internal_packages/onboarding/lib/onboarding-helpers.ts) right after the user finishes the OAuth flow for a new Gmail/Outlook account.So the pattern is: mailsync logs that it's about to fetch an OAuth2 access token, and then the process dies with a native C++ exception before it can log anything else — most likely because Windows security software that intercepts TLS (corporate antivirus, proxies, etc.) causes the HTTPS client to throw mid-request instead of failing gracefully.
MailsyncProcess._buildCrashErroralready has a heuristic for this exact class of problem (TLS interception duringtestmode), but it only fires when mailsync manages to log a{"offline":true}JSON marker before crashing. Here the crash happens too early for that marker to ever be written, so the heuristic never fires, and:oauth-signin-page.tsx's_onErroronly skips reporting to Sentry whenerr.isNetworkError(orisUserError) is set, so this crash — which isn't a fixable Mailspring bug — keeps flooding error tracking.The actual native crash lives in the C++ sync engine (a separate repo), so it can't be root-caused or fixed from this codebase.
The fix
Widen
_buildCrashErrorinapp/src/mailsync-process.tsto also recognize this fingerprint:testmode, exit code0xE06D7363, and a log tail showing the crash happened while fetching an OAuth2 token. When matched, it's classified the same way as the existing{"offline":true}case — the user gets the friendly, localized connection-error message, and the error is no longer reported to Sentry as an unexplained crash.Added
app/spec/mailsync-process-spec.tscovering both the existing offline-marker case and the new OAuth2-crash fingerprint (including that it's scoped totestmode and doesn't misclassify unrelated crashes that happen to share the same exit code).Test plan
_buildCrashErrorcovering both network-failure signatures and the negative cases (wrong mode, unrelated crash with the same exit code)node_modulesinstalled); verified the change compiles cleanly via an isolatedtsccheck🤖 Generated with Claude Code
https://claude.ai/code/session_01BfBhpanbqfLKX7csCsArzN
Generated by Claude Code