Skip to content

[Due for payment 2026-05-07] Expense - Error shows up when duplicating non-reimbursable expenses #88257

Closed

Description

@lanitochka17

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.60-17
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84657
Email or phone of affected tester (no customers): jsodijnsdojnodnjsoinjo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Set Submissions to Instantly.
  • Disable Approvals and Payments.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create two non-reimbursable expenses.
  4. Retract each report (open report > More > Retract).
  5. Go to Reports > Expenses.
  6. Bulk select both expenses.
  7. Click dropdown button > Duplicate expenses.
  8. Go back to workspace chat.
  9. Open both new reports.

Expected Result:

Expenses will be duplicated without issue.

Actual Result:

Two reports are created. Each report contains an expense with error.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7133094_1776529879085.1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

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

    @melvin-bot

    @JS00001 recently merged #84657, but they are OOO right now, so I'll auto-assign someone else.

  3. melvin-bot commented on Apr 18, 2026

    @melvin-bot

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

  4. melvin-bot commented on Apr 18, 2026

    @melvin-bot

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

  5. github-actions commented on Apr 18, 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.
  6. OSBotify commented on Apr 18, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #84657 - "[Duplicate Expense] Allow bulk duplication." by @Krishna2323 (High confidence)
    Related Issues: #84281

    Recommendation: REVERT

    PR #84657 introduced the bulk expense duplication feature which is confirmed to be the source of this bug. The issue is reproducible on staging but not production (this is a new feature that does not exist in production), making a clean revert the safest path forward.

    Assigned: @Krishna2323 (PR author), @situchan (approving reviewer), @JS00001 (approving reviewer) from highest-confidence causing PR only
    Labels: DeployBlockerCash is kept (Frontend bug — App PR caused this). DeployBlocker was not present and was not modified.

    Detailed Analysis

    Evidence

    Verification

    • Affected files: src/libs/actions/IOU/Duplicate.ts, src/hooks/useBulkDuplicateAction.ts, src/components/Search/BulkDuplicateHandler.tsx, src/hooks/useSearchBulkActions.ts
    • PR [Duplicate Expense] Allow bulk duplication.  #84657 directly modifies all of these files — this is the PR that created them.
    • The bulkDuplicateExpenses function in Duplicate.ts iterates over selected transactions and calls duplicateExpenseTransaction for each, passing the existingIOUReport and shouldDeferAutoSubmit for proper sequencing. The bug occurs with non-reimbursable expenses specifically, which involve distinct nonReimbursableTotal tracking on the expense report.

    Root Cause

    The bulkDuplicateExpenses function in src/libs/actions/IOU/Duplicate.ts (introduced by this PR) iterates over selected transactions and builds sequential calls to duplicateExpenseTransaction. For non-reimbursable expenses, the nonReimbursableTotal field on the IOU report is computed per-call in getMoneyRequestInformation in IOU/index.ts. When the first duplicate call produces an optimistic IOU report, subsequent iterations receive it via existingIOUReport, but the nonReimbursableTotal arithmetic across iterations may be incorrect because the optimistic IOU report state is not fully reflected in the module-level allReports cache at the time iteration 2 runs (the comment in the code at line 998-1001 of Duplicate.ts even acknowledges this deferred-state race). This leads to inconsistent report state that the server rejects, surfacing as an error on the duplicated expense. The preconditions (Submissions set to Instantly, Approvals and Payments disabled) likely cause the report to be submitted immediately, exposing the corrupted optimistic state on receipt.

  7. 21 remaining items

  8. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.64-31 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-07. 🎊

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

    • @Krishna2323 requires payment through NewDot Manual Requests
    • @situchan requires payment through NewDot Manual Requests
  9. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    @Krishna2323 / @situchan 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]

  10. melvin-bot commented on May 4, 2026

    @melvin-bot

    @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  11. melvin-bot commented on May 6, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  12. melvin-bot commented on May 7, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  13. mallenexpensify commented on May 7, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Krishna2323 due $250 via NewDot
    Contributor+: @situchan due $250 via NewDot

    @situchan plz complete the BZ checklist and tag me in a post once you have. Thx

  14. situchan commented on May 8, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: missing edge case of new duplicate feature

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/635176

    Regression Test Proposal

    Precondition:

    1. Set Submissions to Instantly.
    2. Disable Approvals and Payments.

    Test:

    1. Go to workspace chat.
    2. Create two non-reimbursable expenses.
    3. Retract each report (open report > More > Retract).
    4. Go to Reports > Expenses.
    5. Bulk select both expenses.
    6. Click dropdown button > Duplicate expenses.
    7. Go back to workspace chat.
    8. Open both new reports.
    9. Verify that expenses are duplicated successfully without error

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-b45f-a770-1282-f017698b0a54
  15. Krishna2323 commented on May 15, 2026

    @Krishna2323
    Contributor

    Requested in ND.

  16. laurenreidexpensify commented on May 19, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @Krishna2323

  17. laurenreidexpensify commented on May 23, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @situchan

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething 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