[Due for payment 2026-11-25] [$250] An admin is unable to submit a report because it is stuck in a Review duplicates loop.
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @clarajones-expensify Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
- Open a report containing a transaction with an active duplicate violation.
- Attempt to submit the report.
- Observe that the primary action is Review duplicates instead of Submit.
- Open Review duplicates.
- Resolve the duplicate and proceed through the confirmation flow.
- Observe that the flow appears to complete successfully.
- Return to the report and attempt to submit again.
- Observe that the duplicate violation is still present and Review duplicates is shown again.
Expected Result:
Resolving the duplicate should persist the resolution to the server and clear the duplicate violation. Once the violation is cleared, Submit should become available. If the duplicate cannot be resolved, the user should receive a clear error explaining why.
Actual Result:
The duplicate resolution flow appears to complete and navigates away as if the resolution succeeded, but no server request is sent to resolve the violation. The duplicate violation remains active, Submit stays blocked, and the user is repeatedly returned to Review duplicates.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome / Safari
Screenshots/Videos
The video for the issue is in Slack thread
Issue Owner
Current Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022112084421385346129
- Upwork Job ID: 2112084421385346129
- Last Price Increase: 2026-10-19
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
Proposal
ℹ️ Medium confidence. The client-side gap is concretely evidenced in the App repo, but the final step of the loop depends on Auth's
RESOLVE_DUPLICATESbehavior, which isn't visible from this repo and would need log/Auth confirmation.
What is the root cause of that problem?
When an admin who is not the report owner confirms in the Review duplicates flow, the app calls resolveDuplicates (not mergeDuplicates), then navigates away unconditionally without checking that the resolution actually took effect:
DynamicConfirmationPage.tsx:130-133 — Navigation.dismissToSuperWideRHP() runs right after resolveDuplicates(...) regardless of what it did, so the flow always looks successful.
The resolution itself is only one-sided. The DUPLICATED_TRANSACTION violation is bilateral (each duplicate's violation data.duplicates points at the others), but the set of transactions actually resolved gets narrowed down two ways:
- Settled/approved duplicates are filtered out at build time.
buildMergeDuplicatesParamsruns the duplicate set throughremoveSettledAndApprovedTransactions(TransactionUtils/index.ts:3102, helper at:2851), so a duplicate on an approved/reimbursed/closed report is dropped fromtransactionIDList. - Duplicates whose report actions aren't loaded in Onyx are skipped at request time.
resolveDuplicatesrebuilds the list, skipping any transaction with no loaded IOU action (Duplicate.ts:508-521) — common when an admin reviews reports/threads they haven't opened.
Meanwhile the optimistic update clears the violation off every transaction using the full list (Duplicate.ts:481-490), so the UI immediately flips to Submit — but the server (Duplicate.ts:595-603) is only told about the kept transactionID with a reduced (possibly empty) transactionIDList, and there is no successData re-confirming the violation removal. The un-resolved counterpart still references the kept transaction, so when the server response (or a queued OpenReport) lands, the DUPLICATED_TRANSACTION violation returns on the kept transaction.
Because getReportPrimaryAction returns REVIEW_DUPLICATES before it ever checks SUBMIT, the reappearing violation flips the button back to Review duplicates — the loop the reporter describes. "No server request is sent" is the observable symptom; more precisely, the request sent is ineffective/one-sided.
Evidence & data flow
- Priority order gates Submit:
REVIEW_DUPLICATESatReportPrimaryActionUtils.ts:524-525is returned before theSUBMITcheck at:540-545. The gate is driven purely by the kept transaction's own Onyx violation entry (isDuplicate,TransactionUtils/index.ts:2259). - The confirm button already half-recognizes this class of bug — the comment at
DynamicConfirmationPage.tsx:214-233says resolving would "only clear the kept transaction, leaving the duplicate violation one-sided" — but it only guards thetransactionIDList.length === 0case, not the non-empty-list-narrowed-to-empty case. - The codebase already has the correct pattern for exactly this:
removeTransactionFromDuplicateTransactionViolation(TransactionUtils/index.ts:2755-2835) walks the other side of each duplicate, strips the kept transaction from itsdata.duplicates, and re-applies the cleaned violations viasuccessData(see the comment at:2821-2828).resolveDuplicates/mergeDuplicatesnever call it.
Flow: A has DUPLICATED_TRANSACTION with data.duplicates = [B, C]; B is on an open report, C on an approved/closed one → admin resolves → transactionIDList = [B] (C dropped) → optimistic clears A/B/C → RHP dismisses → server clears only A's side → C's dangling reference re-flags A → button flips back to Review duplicates → repeat (C is filtered out every time). The same happens on the owner/mergeDuplicates path.
What changes do you think we should make in order to solve the problem?
- Clear the counterpart side of the violation. In both
resolveDuplicatesandmergeDuplicates, reuse the existingremoveTransactionFromDuplicateTransactionViolationpattern so that every transaction referencing the kept one (including settled/approved and not-loaded duplicates) has the kepttransactionIDremoved from itsdata.duplicates, and re-apply the cleaned violations viasuccessDataso a queuedOpenReport/server response can't reintroduce a one-sided violation. - Don't navigate away as if it succeeded when nothing effective happened. In
handleResolveDuplicates, only dismiss after confirming there's actually a resolvable set; if the narrowing (settled/approved filtering + missing report actions) leaves nothing to resolve, surface a clear error instead of silently dismissing — the same way thelength === 0guard already does. - Confirm Auth's
RESOLVE_DUPLICATESbehavior via logs before finalizing (see below) — if Auth only clears the violation for the exacttransactionIDListit's handed, fix #1 is required and sufficient; if Auth clears all referencing transactions, the primary gap is the App narrowing the list.
What alternative solutions did you explore? (Optional)
- Stop excluding settled/approved duplicates from the violation-clearing set even though they're correctly excluded from the actual merge (they can't be merged, but their dangling violation still needs clearing).
- Don't offer "Review duplicates" at all when the only remaining duplicates are on non-mergeable reports, since resolving can never fully clear them.
Why this wasn't verified in-app
Reproduction needs a specific multi-report/multi-user state (a non-owner admin, plus a duplicate sitting on an already-settled/approved report, or unloaded report actions), and the final loop step depends on Auth re-propagating the violation — which isn't observable from a single app session. This is why the issue is marked Needs Reproduction. A log-investigator pass on a real affected report would confirm whether the RESOLVE_DUPLICATES/OpenReport responses re-include DUPLICATED_TRANSACTION for the kept transaction.
Related issues
Quick scan surfaced Expensify/App#96967 (report incorrectly shows a policy violation/RBR after a split is reverted) — possibly related as another stale-violation-not-clearing case, though a different trigger.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/99595) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @gijoe0295 (External)
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
@gijoe0295 Eep! 4 days overdue now. Issues have feelings too...
@gijoe0295 Still overdue 6 days?! Let's take care of this!
@gijoe0295 Still overdue 6 days?! Let's take care of this!
@gijoe0295 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
I don't have time for this yet. Will check back in 1-2 days.
@gijoe0295 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@gijoe0295 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@gijoe0295 Huh... This is 4 days overdue. Who can take care of this?
It's not overdue
I'm working on it
Proposal
Please re-state the problem that we are trying to solve in this issue.
An admin resolves a duplicate transaction group. The UI dismisses the "Review duplicates" screen and optimistically shows Submit - but within seconds (or on the next OpenReport network response), the button flips back to "Review duplicates". The loop repeats indefinitely because no server request is ever effective.
What is the root cause of that problem?
The root cause is a one-sided violation clear inside resolveDuplicates (src/libs/actions/IOU/Duplicate.ts).
Step-by-step breakdown:
-
Suppose transaction A has
DUPLICATED_TRANSACTIONwithdata.duplicates = [B, C]. B is on an open report, C is on an already-settled/approved report. -
The
forloop inresolveDuplicates(lines 511-564) buildsresolvedTransactionIDListby iteratingparams.transactionIDListand skipping any transaction whoseiouActioncannot be found (settled reports often have no loaded report actions). C is silently dropped. Only B ends up inresolvedTransactionIDList. -
optimisticTransactionViolations(lines 484-492) clearsDUPLICATED_TRANSACTIONfor[B, A]only. C is untouched. -
C still holds
data.duplicates = [A]in its Onyx violation entry. -
The
API.write(RESOLVE_DUPLICATES)call sendstransactionIDList = [B]to the server - correct for the merge side, but it means Auth only clears the violation for A and B server-side. -
When the next
OpenReportfires (or when Onyx re-hydrates from a queued command), C's stale violationdata.duplicates = [A]is re-applied to A, restoringDUPLICATED_TRANSACTIONon the kept transaction. -
getReportPrimaryActioninReportPrimaryActionUtils.ts(line 540) checksisReviewDuplicatesActionbefore it checks Submit or Approve. The moment A has the violation again, the button flips back. The loop is complete.
The decisive proof is that the fix already exists in the codebase and is simply not being called. removeTransactionFromDuplicateTransactionViolation (TransactionUtils/index.ts, line 2989) does exactly what is needed: it walks every counterpart in the duplicate graph (via getValidDuplicateTransactionIDs), strips the kept transactionID from each counterpart's data.duplicates, and - critically - pushes the cleaned violations into both optimisticData and successData (lines 3049-3066) so that a subsequent OpenReport or stale queued command cannot reintroduce the one-sided violation. resolveDuplicates never calls it.
What changes do you think we should make in order to solve the problem?
One targeted change in src/libs/actions/IOU/Duplicate.ts inside resolveDuplicates:
Before the API.write call on line 606, build an onyxData object and call removeTransactionFromDuplicateTransactionViolation on it with the kept params.transactionID:
// After building optimisticData and failureData, before API.write:
const onyxData: OnyxData<UpdateMoneyRequestDataKeys> = {
optimisticData,
successData: [],
failureData,
};
removeTransactionFromDuplicateTransactionViolation(
onyxData,
params.transactionID,
allTransactions,
allTransactionViolations,
);
API.write(WRITE_COMMANDS.RESOLVE_DUPLICATES, parameters, onyxData);
This single call walks ALL counterpart transactions in the duplicate graph - including settled/approved ones that were correctly excluded from the merge but whose stale violation reference still needs clearing - and appends the proper optimisticData/successData entries so that no queued OpenReport can reintroduce them.
No server-side change is required. The RESOLVE_DUPLICATES command already clears violations for the transactions it is told about; the gap is purely that the client never told it about the settled/approved counterparts, and never cleaned their Onyx state locally.
What alternative solutions did you explore? (Optional)
Alternative 1 - Expand transactionIDList to include settled/approved transactions.
This would require server-side changes to RESOLVE_DUPLICATES to handle transactions it currently skips (settled/approved). Higher risk, wider blast radius. Rejected in favor of the pure-client fix.
Alternative 2 - Add a successData entry that force-clears the violation on the kept transaction.
This would mask the symptom (A stops showing the violation after the server responds) but C's stale data.duplicates = [A] entry would remain in Onyx, ready to reappear on the next OpenReport. Not a real fix.
Alternative 3 - Block REVIEW_DUPLICATES primary action when all remaining duplicates are on non-mergeable reports.
Correct as a UX guard but does not fix the underlying data corruption. Should be added as a complementary defensive check, not as the primary fix.
@gijoe0295 Whoops! This issue is 2 days overdue. Let's get this updated quick!
Not reproduce yet!
Oops this is a tough one. I tried many cases and here is what I found.
Reproducible steps (two cases):
Precondition:
- User is part of a domain with "Strictly enforce workspace rules" settings enabled
- Has an expense that was paid via Expensify (not just Mark as paid)
Case 1:
- Create a new expense whose amount, merchant and date match exactly as the expense in Precondition
- Press Review duplicates > Keep all
DismissViolationfails with "401 Unauthorized"- Submit is also blocked due to "Strictly enforce workspace rules" settings
Case 2 (matches what the recording in Slack showed):
- Clear cache and reset app
- Open the draft expense above. Do not open the settled expense
- Press Review duplicates
- Only the draft expense shows up here
- Press Keep selected then Confirm
MergeDuplicatesfails with "404 Merging expenses is only permitted for your own reports in an open state or awaiting first level approval, or reports submitted to you..."- Submit is also blocked due to "Strictly enforce workspace rules" settings
We need backend fix for this.
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @mollfpr, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@mollfpr @gijoe0295 this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!