You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-16] [Sentry: APP-H08] Crash toggling Sage Intacct default vendor when vendors list is empty #95342
Optional chaining stops at vendors?.[0]; when the vendors array is empty, [0] is undefined and accessing .id throws. Same pattern exists on the non-reimbursable export page.
Reproduction
Connect a workspace to Sage Intacct with an empty vendors list (or before vendors sync completes).
Root Cause: Optional chaining stops one level too early. In both Sage Intacct export pages the default-vendor toggle reads vendors?.[0].id — the ?. guards vendors being nullish, but not the array being empty. When the synced vendors list is [], vendors?.[0] is undefined and .id throws Cannot read properties of undefined (reading 'id'), matching the Sentry crash on the onToggle path.
Recommended Fix: Add optional chaining before .id → vendors?.[0]?.id. The result is already coalesced with ?? '' at the call site, so an empty list safely produces ''.
✅ This is exactly what PR #95345 does — it changes vendors?.[0].id → vendors?.[0]?.id on both pages and nothing else. The fix is correct and complete for the reported crash.
Investigation details
Symptom → mechanism → confirmation
Stack trace bottoms out at SageIntacctReimbursableExpensesPage.tsxmenuItems.onToggle → vendors?.[0].id, bubbling up through ToggleSettingsOptionRow and Switch. Verified the toggle callback is the only place vendors?.[0].id is dereferenced.
enabled ? …vendors?.[0].id : '' — the crash only fires when toggling ON with an empty/unsynced vendors array, which lines up with the reproduction steps (empty vendors list / before sync completes) and the low event count (needs a Sage Intacct workspace in that transient state).
Alternative explanations considered & ruled out
Not a nullish vendors (that branch is already guarded by ?.) — the failure requires vendors to be a non-null but empty array.
Not a policy/connections/data issue — those are all guarded by the same optional-chaining chain; only the [0] index access is unguarded.
Scope check: The pattern appears on both the reimbursable and non-reimbursable pages, and PR #95345 patches both — matching the "same pattern exists on the non-reimbursable export page" note in the issue. No other vendors?.[0].id occurrences exist in the codebase.
Confidence: High — code evidence matches the Sentry stack trace exactly, the failure condition is reproducible from the code path, and the existing fix targets precisely the faulty expression.
The open fix PR already implements this correctly, so no further code change is needed — this analysis just confirms the root cause and validates the fix.
changed the title [-][Sentry: APP-H08] Crash toggling Sage Intacct default vendor when vendors list is empty[/-][+][Due for payment 2026-07-16] [Sentry: APP-H08] Crash toggling Sage Intacct default vendor when vendors list is empty[/+]on Jul 9, 2026
Activity
mountiny commentedon Jul 5, 2026
Fix PR: #95345
MelvinBot commentedon Jul 6, 2026
Issue Analysis
Root Cause: Optional chaining stops one level too early. In both Sage Intacct export pages the default-vendor toggle reads
vendors?.[0].id— the?.guardsvendorsbeing nullish, but not the array being empty. When the synced vendors list is[],vendors?.[0]isundefinedand.idthrowsCannot read properties of undefined (reading 'id'), matching the Sentry crash on theonTogglepath.SageIntacctReimbursableExpensesPage.tsx:90SageIntacctNonReimbursableExpensesPage.tsx:108Recommended Fix: Add optional chaining before
.id→vendors?.[0]?.id. The result is already coalesced with?? ''at the call site, so an empty list safely produces''.✅ This is exactly what PR #95345 does — it changes
vendors?.[0].id→vendors?.[0]?.idon both pages and nothing else. The fix is correct and complete for the reported crash.Investigation details
Symptom → mechanism → confirmation
SageIntacctReimbursableExpensesPage.tsxmenuItems.onToggle→vendors?.[0].id, bubbling up throughToggleSettingsOptionRowandSwitch. Verified the toggle callback is the only placevendors?.[0].idis dereferenced.enabled ? …vendors?.[0].id : ''— the crash only fires when toggling ON with an empty/unsynced vendors array, which lines up with the reproduction steps (empty vendors list / before sync completes) and the low event count (needs a Sage Intacct workspace in that transient state).Alternative explanations considered & ruled out
vendors(that branch is already guarded by?.) — the failure requiresvendorsto be a non-null but empty array.policy/connections/dataissue — those are all guarded by the same optional-chaining chain; only the[0]index access is unguarded.Scope check: The pattern appears on both the reimbursable and non-reimbursable pages, and PR #95345 patches both — matching the "same pattern exists on the non-reimbursable export page" note in the issue. No other
vendors?.[0].idoccurrences exist in the codebase.Confidence: High — code evidence matches the Sentry stack trace exactly, the failure condition is reproducible from the code path, and the existing fix targets precisely the faulty expression.
The open fix PR already implements this correctly, so no further code change is needed — this analysis just confirms the root cause and validates the fix.
[-][Sentry: APP-H08] Crash toggling Sage Intacct default vendor when vendors list is empty[/-][+][Due for payment 2026-07-16] [Sentry: APP-H08] Crash toggling Sage Intacct default vendor when vendors list is empty[/+]8 remaining items
QichenZhu commentedon Jul 10, 2026
No new Sentry records since the fix went to staging. I believe the crash is resolved.
I'll be OOO from the 13th to 29th of July 2026. If this issue needs attention during that time, please reassign it.
melvin-bot commentedon Jul 15, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jul 15, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 17, 2026
Payment Summary
Contributor+: @QichenZhu due $250 via NewDot
^ Test case created. Thx
trjExpensify commentedon Aug 3, 2026
approved $250 for @QichenZhu