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-04-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace #86095
Version Number: 9.3.42-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:#83896 Email or phone of affected tester (no customers):sdsodsoijnosjdio@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:
Go to staging.new.expensify.com
Go to workspace chat.
Create two expenses.
Delete the workspace.
Create a new workspace.
Open the expense report from the deleted workspace.
Click More > Duplicate report.
Open the new workspace chat.
Open the reports with RBR in LHN.
Expected Result:
Expense report will be duplicated in new workspace without issue.
Actual Result:
Expense report is not duplicated. These expenses show up with RBR in LHN.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #83896 - "Implement core "Duplicate report" action logic." by @Krishna2323 (High confidence) Related Issues: #82153
Recommendation: ROLL FORWARD
The issue can be fixed with a small targeted change to the workspace/chat selection logic. Reverting would remove the entire "Duplicate report" feature, which is a significant new capability.
Labels: This is a Frontend bug (App PR caused the issue). Keeping DeployBlockerCash label as appropriate.
Detailed Analysis
Evidence
PR #83896 introduced the "Duplicate report" feature, which is the exact feature that is failing according to the reproduction steps. The bug only occurs when duplicating a report from a deleted workspace, which is a specific edge case not covered in the original test plan.
Verification
The bug is in src/components/MoneyReportHeader.tsx lines 1927-1928:
When the source workspace is deleted but the policy object still exists, the code incorrectly uses the deleted workspace's policy and chat as the target. This causes the duplicated expenses to show up with RBR (red brick road) errors because they are being created in a deleted/invalid workspace context.
Root Cause
The code needs to check if the user is still a member of the source policy before using it as the target:
Current logic:
If policy exists (even if deleted) → use it
Correct logic:
If policy exists AND user is a member → use it
Otherwise → use default workspace
The fix requires:
Import isPolicyMember from @libs/PolicyUtils in MoneyReportHeader.tsx
Update lines 1927-1928 to check policy membership:
Please re-state the problem that we are trying to solve in this issue.
When a user creates expenses in a workspace, deletes that workspace, then tries to "Duplicate report" on the expense report from the deleted workspace, the duplication fails and the expenses show RBR (Red Brick Road) errors in the LHN.
What is the root cause of that problem?
When a workspace is deleted, only chat rooms, policy expense chats, and task reports are archived — but IOU/expense reports are NOT archived and retain their original policyID pointing to the deleted workspace (useTransactionViolationOfWorkspace.tsx:12-14).
The "Duplicate Report" action has no guard against deleted policies. isDuplicateReportAction (ReportSecondaryActionUtils.ts:801-811) only checks if the user is the submitter and the report is an expense report — it never validates that the report's policy still exists.
In MoneyReportHeader.tsx, the duplicate logic resolves the target policy like this (lines 1927-1928):
If the policy was removed from Onyx by the server:policy is undefined, so it falls back to defaultExpensePolicy (a different workspace). However, the expenses from the original workspace may have categories/tags/settings that don't exist on the new workspace, causing server-side validation failures.
If the policy still exists in Onyx with pendingAction: DELETE (optimistic phase): policy is truthy, so the deleted policy is used directly as the target. The server rejects the request since the policy no longer exists.
In both cases, the API returns errors, which set pendingAction: ADD + error states on the created report actions. These are detected by getAllReportErrors / getViolatingReportIDForRBRInLHN, causing RBR to appear in the LHN.
What changes do you think we should make in order to solve the problem?
The fix should be in MoneyReportHeader.tsx at lines 1927-1928. When determining targetPolicyForDuplicate, we should treat a policy with pendingAction: DELETE the same as a missing policy — i.e., fall back to defaultExpensePolicy:
This ensures that when duplicating a report from a deleted workspace, the duplicate always targets the user's default active workspace instead of trying to use the deleted one.
Additionally, isDuplicateReportAction in ReportSecondaryActionUtils.ts could be hardened to hide the "Duplicate Report" option entirely when the report's policy is deleted and no fallback workspace exists — but the MoneyReportHeader fix is the critical one since shouldShow: !!defaultExpensePolicy already partially handles the "no workspace" case.
What alternative solutions did you explore? (Optional)
Hide the action entirely for deleted-workspace reports: Modify isDuplicateReportAction to check the policy's existence. This was rejected because it's valid to duplicate a report from a deleted workspace into an active workspace — the feature should work, just with the correct target.
Archive expense reports when deleting workspace: Modify useTransactionViolationOfWorkspace to also include IOU/expense reports in reportsToArchive. This would be a larger change with broader implications and doesn't directly fix the duplicate action.
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.
changed the title [-][RCA #83896] Expense - Error when duplicating report from deleted workspace[/-][+][Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/+]on Mar 24, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.42-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@Valforte 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]
changed the title [-][Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/-][+][Due for payment 2026-04-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/+]on Mar 25, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.43-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@Valforte@mallenexpensify 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]
Activity
melvin-bot commentedon Mar 23, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83896
melvin-bot commentedon Mar 23, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 23, 2026
👋 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:
OSBotify commentedon Mar 23, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #83896 - "Implement core "Duplicate report" action logic." by @Krishna2323 (High confidence)
Related Issues: #82153
Recommendation: ROLL FORWARD
The issue can be fixed with a small targeted change to the workspace/chat selection logic. Reverting would remove the entire "Duplicate report" feature, which is a significant new capability.
Labels: This is a Frontend bug (App PR caused the issue). Keeping
DeployBlockerCashlabel as appropriate.Detailed Analysis
Evidence
PR #83896 introduced the "Duplicate report" feature, which is the exact feature that is failing according to the reproduction steps. The bug only occurs when duplicating a report from a deleted workspace, which is a specific edge case not covered in the original test plan.
Verification
The bug is in
src/components/MoneyReportHeader.tsxlines 1927-1928:When the source workspace is deleted but the
policyobject still exists, the code incorrectly uses the deleted workspace's policy and chat as the target. This causes the duplicated expenses to show up with RBR (red brick road) errors because they are being created in a deleted/invalid workspace context.Root Cause
The code needs to check if the user is still a member of the source policy before using it as the target:
Current logic:
policyexists (even if deleted) → use itCorrect logic:
policyexists AND user is a member → use itThe fix requires:
isPolicyMemberfrom@libs/PolicyUtilsin MoneyReportHeader.tsxThis is a simple 3-line fix that handles the deleted workspace edge case properly.
Why Roll Forward Instead of Revert
Krishna2323 commentedon Mar 23, 2026
Working on the PR...
MelvinBot commentedon Mar 23, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates expenses in a workspace, deletes that workspace, then tries to "Duplicate report" on the expense report from the deleted workspace, the duplication fails and the expenses show RBR (Red Brick Road) errors in the LHN.
What is the root cause of that problem?
When a workspace is deleted, only chat rooms, policy expense chats, and task reports are archived — but IOU/expense reports are NOT archived and retain their original
policyIDpointing to the deleted workspace (useTransactionViolationOfWorkspace.tsx:12-14).The "Duplicate Report" action has no guard against deleted policies.
isDuplicateReportAction(ReportSecondaryActionUtils.ts:801-811) only checks if the user is the submitter and the report is an expense report — it never validates that the report's policy still exists.In
MoneyReportHeader.tsx, the duplicate logic resolves the target policy like this (lines 1927-1928):There are two failure modes depending on timing:
policyisundefined, so it falls back todefaultExpensePolicy(a different workspace). However, the expenses from the original workspace may have categories/tags/settings that don't exist on the new workspace, causing server-side validation failures.pendingAction: DELETE(optimistic phase):policyis truthy, so the deleted policy is used directly as the target. The server rejects the request since the policy no longer exists.In both cases, the API returns errors, which set
pendingAction: ADD+ error states on the created report actions. These are detected bygetAllReportErrors/getViolatingReportIDForRBRInLHN, causing RBR to appear in the LHN.What changes do you think we should make in order to solve the problem?
The fix should be in
MoneyReportHeader.tsxat lines 1927-1928. When determiningtargetPolicyForDuplicate, we should treat a policy withpendingAction: DELETEthe same as a missing policy — i.e., fall back todefaultExpensePolicy:This ensures that when duplicating a report from a deleted workspace, the duplicate always targets the user's default active workspace instead of trying to use the deleted one.
Additionally,
isDuplicateReportActioninReportSecondaryActionUtils.tscould be hardened to hide the "Duplicate Report" option entirely when the report's policy is deleted and no fallback workspace exists — but theMoneyReportHeaderfix is the critical one sinceshouldShow: !!defaultExpensePolicyalready partially handles the "no workspace" case.What alternative solutions did you explore? (Optional)
Hide the action entirely for deleted-workspace reports: Modify
isDuplicateReportActionto check the policy's existence. This was rejected because it's valid to duplicate a report from a deleted workspace into an active workspace — the feature should work, just with the correct target.Archive expense reports when deleting workspace: Modify
useTransactionViolationOfWorkspaceto also include IOU/expense reports inreportsToArchive. This would be a larger change with broader implications and doesn't directly fix the duplicate action.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.
Krishna2323 commentedon Mar 23, 2026
PR ready for review: #86098
cc: @hungvu193
melvin-bot commentedon Mar 23, 2026
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.
6 remaining items
[-][RCA #83896] Expense - Error when duplicating report from deleted workspace[/-][+][Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/+]melvin-bot commentedon Mar 24, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 24, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.42-3 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-03-31. 🎊
melvin-bot commentedon Mar 24, 2026
@Valforte 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]
melvin-bot commentedon Mar 24, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)[-][Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/-][+][Due for payment 2026-04-01] [Due for payment 2026-03-31] [RCA #83896] Expense - Error when duplicating report from deleted workspace[/+]melvin-bot commentedon Mar 25, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.43-3 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-04-01. 🎊
melvin-bot commentedon Mar 25, 2026
@Valforte @mallenexpensify 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]