Skip to content

[Due for payment 2026-05-20] Expense - App crashes if expense opens after resolving duplicates by "Keep All" #90064

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.69-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176704/test-cases/41236825
Email or phone of affected tester (no customers): fischer9966+050826aemp@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: iPhone 17 Pro / 26.4.2. Google Pixel 5 / Android 14, MacOS 26.4.1 / Chrome, Safari
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com or open App
  2. Login with new gmail.account
  3. Create new collect workspace
  4. Open the workspace chat
  5. Create two duplicated expenses
  6. Open any of the just created expenses
  7. Click "Review Duplicates"
  8. Click "Keep All"
  9. Click the first expense after resolving duplicates
  10. Wait some seconds

Expected Result:

Expense opens correctly after resolving duplicates by "Keep All"

Actual Result:

App crashes if expense opens after resolving duplicates by "Keep All"

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Video.mp4

logs.txt

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @dmkt9

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 8, 2026
  2. melvin-bot commented on May 8, 2026

    @melvin-bot

    Triggered auto assignment to @AndrewGable (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on May 8, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on May 8, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on May 8, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #88765 - "Fix empty tax code page in Review Duplicates flow" by @MelvinBot (Medium confidence) | Secondary candidate: #51366 - "Open reports at first unread action" by @janicduplessis (Low confidence)
    Related Issues: #85218 (fixed by PR 88765)

    Recommendation: NEEDS INVESTIGATION

    The crash occurs specifically in the "Keep All" path of the duplicate review flow, which does not go through the Confirmation.tsx or mergeDuplicates/resolveDuplicates code paths modified by PR 88765. However, PR 88765 is the only staging PR that directly touches the duplicate review flow code. A secondary candidate, PR 51366, makes significant architectural changes to how reports are opened (scrolling to first unread action), which could interact with the new dismissed-violation report action added by "Keep All". Neither candidate is confirmed without reproduction and stack trace data from Sentry.

    Assigned: @MelvinBot (PR author), @dmkt9, @stitesExpensify (approving reviewers) from highest-confidence causing PR | @janicduplessis (author of secondary candidate)
    Labels: DeployBlockerCash label kept (staging-only bug with App PR candidates). No label changes made.

    Detailed Analysis

    Evidence

    PR 88765 - Fix empty tax code page in Review Duplicates flow:

    • Merged 2026-05-04, directly in the StagingDeployCash list.
    • Modified src/libs/actions/IOU/Duplicate.ts, src/pages/TransactionDuplicate/Confirmation.tsx, src/libs/TransactionUtils/index.ts, src/libs/API/parameters/MergeDuplicatesParams.ts, and src/libs/API/parameters/ResolveDuplicatesParams.ts.
    • Significantly refactored Confirmation.tsx with new useOnyx hooks for duplicatedTransactionPolicy, new taxData memoization, and changed how handleMergeDuplicates and handleResolveDuplicates are called.
    • Introduced a new buildOptimisticTransactionData helper that now explicitly sets taxName: taxCode ? null : originalSelectedTransaction?.taxName.
    • However, the "Keep All" user flow does NOT go through Confirmation.tsx or mergeDuplicates/resolveDuplicates. It calls dismissDuplicateTransactionViolation in Transaction.ts directly from Review.tsx.

    PR 51366 - Open reports at first unread action:

    • Merged 2026-05-08, in the StagingDeployCash list.
    • Significantly changes ReportActionsView.tsx, ReportActionsList.tsx, usePaginatedReportActions.ts, PaginationUtils.ts, and useFlashListScrollKey.ts.
    • "Keep All" (dismissDuplicateTransactionViolation) adds a new optimistic DISMISSED_VIOLATION report action to each transaction's thread report. When the user subsequently opens an expense thread, PR 51366's new logic tries to scroll to the "first unread action" - which could be the newly-added dismissed violation action. If the pagination or scroll-key logic encounters an unexpected state (null/undefined) in this path, it could cause a crash.
    • The "Wait some seconds" in the repro steps is consistent with an async pagination/scroll operation failing after the initial render.

    Why this is staging-only: Both PRs are new to staging and not in production.

    Platforms affected: Crash is on iOS App, Android App, Windows Chrome, MacOS Chrome/Safari - consistent with a JavaScript-level crash rather than platform-specific.

    Verification

    • PR 88765 verified to modify src/pages/TransactionDuplicate/Confirmation.tsx, src/libs/actions/IOU/Duplicate.ts, and src/libs/TransactionUtils/index.ts - all core to the duplicate review flow.
    • PR 51366 verified to modify src/pages/inbox/report/ReportActionsView.tsx, src/pages/inbox/report/ReportActionsList.tsx, src/hooks/usePaginatedReportActions.ts - core to how expense thread reports are opened.
    • The "Keep All" code path in src/pages/TransactionDuplicate/Review.tsx calls dismissDuplicateTransactionViolation then Navigation.goBack(). The function adds new report actions to the transaction thread.

    Root Cause

    Cannot be definitively confirmed without a Sentry stack trace. Two plausible theories:

    1. PR 88765 side-effect theory: Changes to buildOptimisticTransactionData (setting taxName: null) or changes to Confirmation.tsx's hooks may have introduced a state inconsistency in the REVIEW_DUPLICATES Onyx key that persists after "Keep All" and causes a crash when the expense is subsequently opened.

    2. PR 51366 interaction theory: After "Keep All" dismisses the duplicate violation and adds a new report action to the expense thread, PR 51366's new "open at first unread action" logic encounters unexpected pagination state (the newly-created dismissed violation action as the anchor) and crashes. The "Wait some seconds" timing in the repro steps supports an async scroll/pagination operation failing.

    The PR authors and reviewers should be looped in to confirm which path is actually crashing, likely using Sentry crash data from staging.

  6. MelvinBot commented on May 8, 2026

    @MelvinBot
    Contributor

    Proposal

    Problem: After resolving duplicate expenses via "Keep All", opening one of the expenses causes the app to crash a few seconds later.

    Root Cause: The crash is triggered by the DismissViolation server response arriving while the user is viewing a transaction thread. The keepAll function in Review.tsx:151-161 calls dismissDuplicateTransactionViolation (which optimistically removes DUPLICATED_TRANSACTION violations) and then Navigation.goBack(). When the server processes this a few seconds later, it sends back Onyx updates that trigger a re-render cascade across several deeply-subscribed components.

    On a Collect workspace (the repro steps create one), auto-submit is enabled by default. When the duplicate violation — the only blocking violation — is dismissed, the server likely auto-submits the expense report, changing its statusNum from OPEN to SUBMITTED. This state transition propagates through the reportTransactionsAndViolations derived value and into the component tree viewing the transaction thread, where MoneyRequestHeader, MoneyRequestHeaderPrimaryAction, and MoneyRequestReportTransactionsNavigation all re-render simultaneously with changed violation, report action, and report state data.

    Additionally, the successData in dismissDuplicateTransactionViolation sets optimistic dismissed-violation report actions to null on the transaction thread reports exactly when the user may be viewing them.

    Confidence: Medium — the code investigation confirms the mechanism (optimistic removal → server response → state transition → re-render cascade), but without the Sentry crash stack trace for version 9.3.69-0, I cannot pinpoint the exact line that throws. The timing ("wait some seconds") strongly correlates with server response arrival.

    Investigation details

    Key code flow

    1. Keep All button (Review.tsx:151) calls dismissDuplicateTransactionViolation + Navigation.goBack()
    2. Optimistic updates (Transaction.ts:601-626): removes DUPLICATED_TRANSACTION violations, adds dismissedViolations to transactions, creates optimistic report actions, updates expense report nextStep
    3. Server response (Transaction.ts:659-671): successData nullifies optimistic report actions on transaction thread reports + server may push additional auto-submit updates
    4. Crash: one or more of the transaction thread components encounters unexpected state during the combined re-render

    Potential regression PRs in 9.3.69-0

    What would confirm/disprove this

    • Sentry crash stack trace for 9.3.69-0 would immediately identify the exact component and line
    • Testing on a workspace without auto-submit could isolate whether the auto-submit state transition is the trigger
    • Checking if the crash also occurs with "Review Duplicates" → confirm one (merge) flow, or only with "Keep All"

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. 3 remaining items

  8. m-natarajan commented on May 9, 2026

    @m-natarajan

    Not repro, Chrome and iPhone13/26.4.2 / v9.3.69-3 (Waiting for validation on Android)

    ScreenRecording_05-09-2026.16-14-50_1.MP4
    REC-20260509204736.mp4
  9. removed
    DeployBlockerCashThis issue or pull request should block deployment
    on May 11, 2026
  10. melvin-bot commented on May 12, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. added
    ReviewingHas a PR in review
    and removed
    ReviewingHas a PR in review
    on May 12, 2026
  12. changed the title [-]Expense - App crashes if expense opens after resolving duplicates by "Keep All"[/-] [+][Due for payment 2026-05-20] Expense - App crashes if expense opens after resolving duplicates by "Keep All"[/+] on May 13, 2026
  13. melvin-bot commented on May 13, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on May 13, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-20. 🎊

    For reference, here are some details about the assignees on this issue:

    • @janicduplessis does not require payment (Contractor)
    • @dmkt9 requires payment (Needs manual offer from BZ)
  15. melvin-bot commented on May 13, 2026

    @melvin-bot

    @dmkt9 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions