Skip to content

[Due for payment 2026-05-07] Expense - "You can't export an empty report." is shown when exporting deleted expense #88418

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.61-0
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: #88192
Email or phone of affected tester (no customers): sdsodijnosdjoij@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:

  • Delete an expense in workspace chat.
  1. Go to staging.new.expensify.com
  2. Go to Reports > All xpenses.
  3. Enter status:deleted on the search field and search.
  4. Select the deleted expense via checkbox.
  5. Click dropdown button > Export > All Data - expense level.

Expected Result:

All Data - expense level will be hidden if the deleted expense cannot be exported.

Actual Result:

"You can't export an empty report." is shown when exporting deleted expense.

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

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 21, 2026
  2. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #88192

  3. melvin-bot commented on Apr 21, 2026

    @melvin-bot

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

  4. github-actions commented on Apr 21, 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 Apr 21, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #88192 - "Export and duplicated deleted expenses" by @jnowakow (High confidence)
    Related Issues: #88088

    Recommendation: REVERT

    PR #88192 added the export option to deleted expense bulk actions, but the export flow incorrectly passes the trash report ID, and the backend (or client-side logic) rejects the export with "You can't export an empty report" because deleted transactions are filtered out when resolving report transactions for export.

    Assigned: @jnowakow (PR author), @rojiphil @luacmartins (approving reviewers)
    Labels: DeployBlockerCash kept (Frontend bug — fix is in Expensify/App). No label changes made.

    Detailed Analysis

    Evidence

    • The issue reporter links directly to PR Export and duplicated deleted expenses #88192 in the bug report and the melvin-bot assigned the PR author as the deploy blocker owner.
    • PR Export and duplicated deleted expenses #88192 is in the StagingDeployCash checklist (entry Navigation Drawer #134 in chronological order).
    • The bug is reproducible on staging only, and the issue is labeled "new feature, doesn't exist in prod" — consistent with this being a staging-only regression introduced by this PR.
    • The PR's purpose was to allow export and duplicate of deleted expenses via the bulk action dropdown in search results.

    Verification

    • The only file changed by PR Export and duplicated deleted expenses #88192 in src/ is src/hooks/useSearchBulkActions.ts.
    • The PR moved the allSelectedAreDeleted early-return block from line ~867 (where it returned only the undelete option) to after the exportButtonOption was built (~line 1036), and added exportButtonOption into the deletedTransactionOptions array.
    • The affected code path is confirmed: useSearchBulkActions.ts is the file that controls which bulk action dropdown items appear in the search header.

    Root Cause

    Before this PR, when all selected transactions were deleted, the hook returned early with only the "Undelete" option — no export option was shown. This was intentional: deleted transactions belong to the trash report (CONST.REPORT.TRASH_REPORT_ID), not a real expense report.

    PR #88192 moved this early-return block to later in the function, after exportButtonOption is constructed, and included exportButtonOption in the deleted-transaction options. When a user then selects "All Data - expense level" export for a deleted expense, the export handler (handleBasicExport) passes the trash report's ID as the reportIDList. The exportSearchItemsToCSV function in Search.ts iterates over report transactions and skips any with pendingAction === DELETE — leaving the report with zero valid transactions. The backend (or the CSV generation logic) then returns the "You can't export an empty report" error.

    The fix location is in src/hooks/useSearchBulkActions.ts — either by reverting PR #88192 or by adding a guard inside getExportOptions / handleBasicExport to exclude deleted transactions from the export flow.

  6. MelvinBot commented on Apr 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR Expensify/App#88192 added the exportButtonOption to the deletedTransactionOptions array in useSearchBulkActions.ts:1049. Deleted transactions have reportID: '-1' (TRASH_REPORT_ID), which is a pseudo-report that doesn't exist on the backend. When the user triggers an export, the report ID list ['-1'] is sent to the server, which can't find any exportable data and returns "You can't export an empty report."

    The client-side empty-report guard at lines 351-364 doesn't catch this because it checks transactionCount on the report object from search results — the trash "report" may have a non-zero transaction count since it aggregates all deleted transactions.

    What changes do you think we should make in order to solve the problem?

    Remove exportButtonOption from the deletedTransactionOptions array at useSearchBulkActions.ts:1049. Deleted expenses live under a fake report ID (-1) and cannot be exported — the Export option should not be shown for them.

    What alternative solutions did you explore? (Optional)

    An alternative would be to filter TRASH_REPORT_ID out of reportIDList before sending to the backend in both beginExportWithTemplate and handleBasicExport. However, this is more complex and the result would be the same — nothing to export. Simply hiding the option is the cleaner fix.

    Supporting evidence
    • allSelectedAreDeleted is computed at line 869 by checking if every selected transaction has reportID === CONST.REPORT.TRASH_REPORT_ID
    • TRASH_REPORT_ID is defined as '-1' at CONST/index.ts:1317
    • selectedTransactionReportIDs at line 289 resolves to ['-1'] for deleted transactions
    • Both export paths (beginExportWithTemplate at line 380 and handleBasicExport at line 464) send this -1 report ID to the backend

    Possibly related: Expensify/App#88088 — "Deleted expense can be duplicated and exported when bulk selecting it with existing expense" (same area, still open).


    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. luacmartins commented on Apr 21, 2026

    @luacmartins
    Contributor

    I think we can demote this one since it's a bit of an edge case. @jnowakow can you work on a fix for it tomorrow please?

  8. 9 remaining items

  9. melvin-bot commented on Apr 30, 2026

    @melvin-bot

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

  10. 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:

    • @rojiphil requires payment through NewDot Manual Requests
    • @jnowakow does not require payment (Contractor)
  11. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    @rojiphil 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]

  12. rojiphil commented on May 1, 2026

    @rojiphil
    Contributor

    @mallenexpensify No payment due here. Please close this issue as this can be included as part of the delete feature payment here. Thanks

  13. melvin-bot commented on May 4, 2026

    @melvin-bot

    @rojiphil Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  14. melvin-bot commented on May 6, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on May 7, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    • Reviewer: @rojiphil owed $250 via NewDot
    • Contributor: @jnowakow does not require payment (Contractor)

    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
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