[$175] Duplicate error "new expenses cannot be added to this report" is displayed
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.54-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/107654 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: windows 10/chrome App Component: Other
Action Performed:
Precondition: Create a workspace with Account A as a member and Account B as the approver
Steps:
- As Account A, create a manual expense and a scanned receipt expense on an open workspace report
- As Account A submit the expense report to Account B.
- As Account A, go to Account > Troubleshoot and turn Force offline on.
- As Account B, open and approve the submitted expense report.
- As Account A (still offline), open that same report and add a manual expense and a scanned receipt expense to it.
- As Account A, turn Force offline off.
- Verify error messages are displayed
Expected Result:
There should be no duplicate error messages, but only one error message under failed expense
Actual Result:
There is a duplicate error message "new expenses cannot be added to this report" in report page
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/7b09bd76-3611-404c-b51b-88482a978cdf
Applause Internal Information Exported by: Mita Rachim Bug ID: 7324553
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022125853339367718753
- Upwork Job ID: 2125853339367718753
- Last Price Increase: 2026-11-26
Issue Owner
Current Issue Owner: @ShridharGoel
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/1b5b29958b09d0015731fb47402c82e321b01965b41427610a28aa4580f597bd
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)
Job added to Upwork: https://www.upwork.com/jobs/~022125853339367718753
Proposal
What is the root cause of that problem?
Likely cause — medium confidence: The expense report table has two independent places that display the same expense’s rejection: the transaction row’s error indicator and a separate error row underneath it. Deduplicating stored error strings does not prevent both components from displaying the same message.
Code evidence
- MoneyRequestReportTransactionItem.tsx:277–358 renders both the transaction row and a separate
ErrorMessageRow. - TransactionItemRowRBR.tsx:75–132 independently displays messages derived from that transaction’s errors.
- reconcileFailureDataWithServerErrors.ts:42–79 removes redundant client strings and preserves receipt retry metadata, but does not coordinate those two UI renderers.
This explains how one failed expense can display its rejection twice without duplicate requests or duplicate stored strings.
What changes do you think we should make in order to solve the problem?
Give each rejection a single display owner within the report table. Coordinate the transaction-row indicator with the separate error row so an already-displayed rejection is not repeated.
Preserve distinct violations, error dismissal, and scanned-receipt Try again/Save behavior. Do not deduplicate across expenses: two failed expenses should each retain their own error.
Verification and regression coverage
Web reproduction was blocked, not failed: the tester could not operate a second account to approve the report while the first remained offline. Therefore, attribution to this particular report remains unconfirmed.
Before implementing, confirm that both messages belong to the same expense, rather than one message belonging to each failed expense.
Regression coverage should render the complete report-table item and verify:
- One rejection per manual or scanned expense.
- Two expenses with identical rejection text retain independent feedback.
- Receipt recovery, dismissal, and unrelated violations remain available.
- Both wide and narrow layouts behave correctly.
What alternative solutions did you explore? (Optional)
Changing client/server error reconciliation alone would not address two components displaying the same error. Globally hiding transaction-row errors would risk suppressing unrelated validation feedback.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/108054) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a manual and a scanned expense added offline to an already-approved report fail on reconnect, the report page shows the server rejection "new expenses cannot be added to this report" twice under the same failed expense instead of once.
What is the root cause of that problem?
Since #107654, the server's rejection string is kept in transaction.errors for the failed expense. The server's onyxData writes {<serverKey>: "new expenses cannot be added…"} on transactions_<id>, and reconcileFailureDataWithServerErrors drops the client's generic string. For the scan, it copies the same text into the ReceiptError.message. So each failed row ends up with exactly one string error, the server one.
In the report table, two separate components render that same string for the same row:
MoneyRequestReportTransactionItembuildsmessageErrorsfrom the string entries oftransaction.errorsand renders them in its own<ErrorMessageRow errors={transactionErrors}>(with the dismiss X).- The
<TransactionItemRow>it renders just above that row keeps the defaultshouldShowErrors = true, so the wide and narrow rows mountTransactionItemRowRBR. That component callsgetRBRMessages, which runsextractErrorMessages(transaction.errors, …)and adds the same string again. For the scan, it also adds theReceiptError.message, which since #107654 is the same text, so the Set collapses it to one.
The Set inside extractErrorMessages only removes duplicates within the RBR. Nothing removes duplicates between the RBR and the ErrorMessageRow, so each failed expense shows the message twice (once in the RBR and once in the dismissable error row). Before #107654, the client's generic failure was a translation-key object that messageErrors filters out. The ErrorMessageRow usually stayed empty for these failures, which is why this only shows up now.
What changes do you think we should make in order to solve the problem?
Let the dismissable ErrorMessageRow be the only place that shows transaction.errors strings in the report table, and keep the RBR for everything else:
- Add an optional prop to
TransactionItemRow→DeferredTransactionItemRowRBR→TransactionItemRowRBR, e.g.shouldExcludeTransactionStringErrors(defaultfalse, so Search and other users of the row don't change). - When it's
true,TransactionItemRowRBRpassestransaction.errorstogetRBRMessageswithout its plain string entries, the same filterMoneyRequestReportTransactionItemalready uses formessageErrors. Receipt errors without a server message, transaction-thread action errors, violations andmissingFieldErrorstill show in the RBR as they do today. The early-return check inTransactionItemRowRBRshould use the same filtered errors so it doesn't mount an empty RBR. MoneyRequestReportTransactionItempassesshouldExcludeTransactionStringErrorstoTransactionItemRow, because it already renders those strings in itsErrorMessageRow.- In the same filter, drop a
ReceiptErrorwhosemessageequals a string thatErrorMessageRowalready shows. Then the scanned expense also shows the rejection only once, and its retry and save stay in the expense view.
Result: each failed expense (manual or scanned) shows the rejection exactly once, under the row, and the user can still dismiss it. Two failed expenses still each show their own message, and violations stay visible.
What alternative solutions did you explore? (Optional)
- Pass
shouldShowErrors={false}toTransactionItemRowfrom the report table. Rejected: it also hides violations and missing-field errors. - Remove the
ErrorMessageRowand rely on the RBR. Rejected: that loses the dismiss action (clearError) for failed expenses.
How this differs from MelvinBot's proposal: Melvin points at the same two renderers but leaves the fix open ("coordinate … a single display owner") and could not confirm the scenario. This proposal traces the exact data flow from #107654 (why it's the same string, and why it only shows up now) and gives a concrete fix that only applies to the report table. That fix keeps violations, dismissal and per-expense errors, and it doesn't change Search rows.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01be5d412b545fdf18
Proposal
Please re-state the problem that we are trying to solve in this issue?
When expenses added offline to an already-approved workspace report fail upon reconnecting (returning server rejection "new expenses cannot be added to this report"), the report page displays the rejection message twice under the same failed transaction row: once inside the Red Bullet Row (RBR) indicator and once directly beneath in the dismissible error container (ErrorMessageRow).
What is the root cause of that problem?
Recent PR #107654 (reconcileFailureDataWithServerErrors.ts) updated server error handling to preserve the server's rejection string directly in transaction.errors (e.g. {[timestamp]: "new expenses cannot be added to this report"}), and for scanned receipts, also into ReceiptError.message. Prior to PR #107654, client generic failure data used translation-key objects that were filtered out from messageErrors, so ErrorMessageRow did not mount for these errors.
With the raw string now stored in transaction.errors:
- In
MoneyRequestReportTransactionItem.tsx:183-195,messageErrorsextracts string entries fromtransaction.errorsand passes them to<ErrorMessageRow errors={transactionErrors} onDismiss={dismissTransactionError} />(rendered directly beneath<TransactionItemRow>). This component renders the dismissible error banner with an[X]dismiss button. - In
<TransactionItemRow>(rendered directly above),TransactionItemRowWide.tsx:815-826andTransactionItemRowNarrow.tsx:196-207mount<DeferredTransactionItemRowRBR>/<TransactionItemRowRBR>. - In
TransactionItemRowRBRInner,ViolationsUtils.getRBRMessagescallsextractErrorMessages(transaction?.errors ?? {}, ...)(ViolationsUtils.ts:509-543), which extracts the same string fromtransaction.errors(and the matchingReceiptError.message) and renders● new expenses cannot be added to this report.as a red bullet item within the transaction row.
Because extractErrorMessages only deduplicates within the RBR itself, and there was no coordination between TransactionItemRowRBR and the report view's external ErrorMessageRow, both UI components render the exact same error message under the same expense.
What changes do you think we should make in order to solve the problem?
On the Money Request Report view (MoneyRequestReportTransactionItem), ErrorMessageRow is the designated container for transaction-level message errors because it provides the user with an actionable dismiss button (clearError). Therefore, transaction-level message errors that are already handled by ErrorMessageRow should be excluded from the row's RBR, while retaining all policy violations, missing field errors, and thread errors in the RBR:
-
In
src/components/TransactionItemRow/types.ts: Add an optional propshouldExcludeTransactionErrors?: booleantoTransactionItemRowProps. -
In
src/components/TransactionItemRow/index.tsx: ExtractshouldExcludeTransactionErrors = falseand forward it throughnarrowForwardedPropsandwideForwardedProps. -
In
src/components/TransactionItemRow/TransactionItemRowNarrow.tsx&TransactionItemRowWide.tsx: ForwardshouldExcludeTransactionErrorsto<DeferredTransactionItemRowRBR>. -
In
src/components/TransactionItemRow/TransactionItemRowRBR.tsx:- Accept
shouldExcludeTransactionErrors?: booleaninTransactionItemRowRBRPropsandTransactionItemRowRBRInnerProps. - In
TransactionItemRowRBRInner: WhenshouldExcludeTransactionErrorsistrue, filtertransaction.errorsbefore passing toViolationsUtils.getRBRMessagesto exclude plain string message errors (typeof errorValue === 'string') and server-attached receipt error messages (isReceiptError(errorValue) && errorValue.message?.trim()):const transactionForRBR = useMemo(() => { if (!shouldExcludeTransactionErrors || !transaction?.errors) { return transaction; } const filteredErrors = Object.fromEntries( Object.entries(transaction.errors).filter(([, errorValue]) => { if (typeof errorValue === 'string') { return false; } if (isReceiptError(errorValue) && errorValue.message?.trim()) { return false; } return true; }), ); return { ...transaction, errors: filteredErrors, }; }, [shouldExcludeTransactionErrors, transaction]); - In
TransactionItemRowRBR: Update the early-return check to evaluatehasVisibleTransactionErrorsso that whenshouldExcludeTransactionErrorsis true and no violations, missing fields, or thread errors exist, the component returnsnullimmediately and mounts zero DOM nodes.
- Accept
-
In
src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx: PassshouldExcludeTransactionErrorsto<TransactionItemRow />.
What alternative solutions did you explore? (Optional)?
- Passing
shouldShowErrors={false}fromMoneyRequestReportTransactionItem: Rejected becauseshouldShowErrors={false}completely suppresses<DeferredTransactionItemRowRBR>, which would hide legitimate policy violations (e.g., category required, receipt missing, out of policy limit), missing field errors, and transaction thread errors. - Removing
ErrorMessageRowand relying solely on RBR: Rejected because RBR is an inline indicator that lacks a dismiss affordance (clearError). The dismissible error row is standard across report transaction views.
What are the regression risks and how will you mitigate them?
- Search and other transaction lists: In Search table views and unreported expense lists,
MoneyRequestReportTransactionItemis not used.TransactionItemRowdefaultsshouldExcludeTransactionErrors = false, preserving 100% of existing RBR behavior where no externalErrorMessageRowis present. - Policy violations and thread errors: Policy violations (
violations), missing fields (missingFieldError), and action thread errors (transactionThreadActions) remain untouched and continue to render in RBR as expected. - Mitigation: Verified with comprehensive automated unit tests in
MoneyRequestReportTransactionItemRejectErrorTest.tsx.
Automated Tests?
Add the following test cases to tests/ui/MoneyRequestReportTransactionItemRejectErrorTest.tsx:
it('should show server creation/reconnection error once under the row, not duplicated in RBR', async () => {
// Given an expense with a server rejection error string
const serverErrorMessage = 'new expenses cannot be added to this report';
const transactionWithServerError = buildTransaction({
errors: {[ERROR_TIMESTAMP]: serverErrorMessage},
});
await renderTransactionItem(transactionWithServerError);
// Then: The error message is rendered exactly once by ErrorMessageRow and not duplicated in RBR
expect(screen.getAllByText(serverErrorMessage)).toHaveLength(1);
expect(screen.queryByTestId('TransactionItemRowRBR')).not.toBeOnTheScreen();
});
it('should show server scanned receipt error once under the row without duplicating in RBR', async () => {
// Given a scanned expense with a server error message preserved in ReceiptError
const serverErrorMessage = 'new expenses cannot be added to this report';
const transactionWithReceiptServerError = buildTransaction({
errors: {
[ERROR_TIMESTAMP]: serverErrorMessage,
receipt: {message: serverErrorMessage, receiptID: 123},
},
});
await renderTransactionItem(transactionWithReceiptServerError);
// Then: The error message is rendered exactly once by ErrorMessageRow and not duplicated in RBR
expect(screen.getAllByText(serverErrorMessage)).toHaveLength(1);
expect(screen.queryByTestId('TransactionItemRowRBR')).not.toBeOnTheScreen();
});
Manual Test Steps?
- Create a workspace with Account A as member and Account B as approver.
- As Account A, create an expense and submit the report to Account B.
- As Account A, enable Troubleshoot > Force offline.
- As Account B, open and approve the submitted report.
- As Account A (offline), add a manual expense and a scanned receipt expense to the report.
- As Account A, disable Force offline.
- Verify that each failed expense displays the server rejection error ("new expenses cannot be added to this report") exactly once in the dismissible error container with an
[X]button, and that no duplicate red bullet error text is rendered in the row. - Click
[X]on the error container and verify that the error dismisses cleanly.
Contributor Details?
- GitHub Username: @kevinjosh10
- Email: [email protected]
- Upwork Profile: https://www.upwork.com/freelancers/~0131dae36abcf59374
Proposal
Please re-state the problem that we are trying to solve in this issue.
After adding a manual expense and a scanned receipt expense offline to an already-approved workspace report and reconnecting, the report's expense list renders the server rejection "new expenses cannot be added to this report" twice for each failed expense instead of once.
What is the root cause of that problem?
Two separate components inside the same report-table row independently display the same server rejection message:
MoneyRequestReportTransactionItem.tsx#L181-L194extracts plain-string entries fromtransaction.errors, selects the single error to show viarejectErrorKey ? rejectError : getLatestErrorMessageField({errors: messageErrors}), and renders it in<ErrorMessageRow errors={transactionErrors} onDismiss={dismissTransactionError} />.- Right above it,
<TransactionItemRow>keepsshouldShowErrors = true, so both wide (TransactionItemRowWide.tsx#L827-L836) and narrow (TransactionItemRowNarrow.tsx#L196-L207) rows mountTransactionItemRowRBR. TransactionItemRowRBR.tsx#L76-L90callsViolationsUtils.getRBRMessages→extractErrorMessages, which merges bothtransaction.errors(plain strings andReceiptError.message) andtransactionThreadActions(action.errors) intouniqueMessages. Since #107654,reconcileFailureDataWithServerErrors.ts#L42-L79preserves the server rejection string acrosstransactions_*,ReceiptError.message, andreportActions_*. BecauseextractErrorMessagesonly deduplicates within the RBR string and has no knowledge of whatErrorMessageRowis already rendering underneath the same row, the server rejection renders twice (once inTransactionItemRowRBR, once inErrorMessageRow).
Why filtering all string entries out of transaction.errors in TransactionItemRowRBR (as in the earlier proposal) is fragile:
- Misses thread-action errors:
extractErrorMessages(ViolationsUtils.ts#L514-L520) also mergestransactionThreadActions(action.errors), andreconcileFailureDataWithServerErrorsexplicitly handles server errors onreportActions_*. Strippingtransaction.errorsalone cannot deduplicate a matching server rejection present on an action intransactionThreadActions. - Drops non-displayed errors when
rejectErrorKeyor multiple distinct errors exist:ErrorMessageRowrenders at most one message (rejectErrorKey ? rejectError : getLatestErrorMessageField({errors: messageErrors}),MoneyRequestReportTransactionItem.tsx#L193). Blindly dropping every plain string intransaction.errorsinsideTransactionItemRowRBRhides errors thatErrorMessageRowis not currently displaying (for example, whenrejectErrorKeyoverridesmessageErrorswithcouldNotRejectExpense, or when an older distinct error exists alongside a newer one). - Duplicates filtering heuristics: Re-implementing
typeof entry[1] === 'string'+ReceiptError.messagematching inTransactionItemRowRBRsplits display ownership across two files instead of using the renderedErrorMessageRowmessages as the single source of truth.
What changes do you think we should make in order to solve the problem?
Deduplicate RBR messages against the exact message(s) ErrorMessageRow is already displaying for that row, using MoneyRequestReportTransactionItem as the single source of truth:
-
Derive the exact displayed message list in
MoneyRequestReportTransactionItem.tsx#L193-L195:- Extract
displayedErrorMessages: string[]fromtransactionErrors(specifically, when!rejectErrorKey, take the non-empty trimmed string values oftransactionErrors—which is at most the single latest string error rendered byErrorMessageRow; whenrejectErrorKeyis set, leave it empty socouldNotRejectExpensenever hides unrelated string errors). - Pass
excludedErrorMessages={displayedErrorMessages}(only when non-empty) into<TransactionItemRow>.
- Extract
-
Forward optional
excludedErrorMessages?: string[]throughTransactionItemRow→TransactionItemRowWide/TransactionItemRowNarrow→DeferredTransactionItemRowRBR→TransactionItemRowRBR:- Default to
undefinedso Search rows and all other callers ofTransactionItemRowremain completely unchanged. - Pass
excludedErrorMessagesintoViolationsUtils.getRBRMessagesinTransactionItemRowRBR.tsx#L76-L90. - Because
TransactionItemRowRBRInneralready returnsRBRMessages.length > 0 && (...)(#L93-L95), when all extracted error messages are excluded and there are no violations ormissingFieldError, no empty RBR container is mounted.
- Default to
-
Filter matching messages at the single extraction point in
ViolationsUtils.ts#L509-L545and#L1397-L1429:- Accept optional
excludedErrorMessages?: string[]ongetRBRMessagesand forward it toextractErrorMessages. - Normalize
excludedErrorMessagesinto a trimmedSet<string>and omit any extracted message whose.trim()is in that set before returningArray.from(uniqueMessages). - This single check handles all three duplicate vectors uniformly:
transaction.errorsplain string (manual expense),ReceiptError.messagepopulated byreconcileFailureDataWithServerErrors(scanned receipt expense), and- identical server error strings on
transactionThreadActions(action.errors).
- Meanwhile, generic receipt upload failures (where
ReceiptError.messageis empty and falls back toiou.error.receiptFailureMessageShort), distinct error strings,missingFieldError, violations, per-expense errors across multiple failed rows, andErrorMessageRowdismissal (clearErrorinsrc/libs/actions/Transaction.ts#L763-L770) all continue working unchanged.
- Accept optional
-
Tests:
- Extend
tests/unit/ViolationUtilsTest.ts(describe('getRBRMessages')) to verifyexcludedErrorMessages:- omits matching string error, matching
ReceiptError.message, and matchingtransactionThreadActionserror; - retains violations,
missingFieldError, non-matching distinct error strings, and genericReceiptErrorwithout a server message.
- omits matching string error, matching
- Extend
tests/ui/TransactionItemRowRBRTest.tsxand add a full report-row UI test alongsidetests/ui/MoneyRequestReportTransactionItemRejectErrorTest.tsxverifying:- a failed manual expense and a failed scanned expense in
MoneyRequestReportTransactionItemeach render"new expenses cannot be added to this report"exactly once (inside dismissibleErrorMessageRow) in both wide and narrow layouts; - two failed expenses on the same report each keep their own error row;
- a row with both a server rejection and a violation renders the rejection once in
ErrorMessageRowand the violation inTransactionItemRowRBR; - a row with
rejectErrorKeydoes not lose unrelated RBR errors.
- a failed manual expense and a failed scanned expense in
- Extend
What alternative solutions did you explore? (Optional)
- Boolean
shouldExcludeTransactionStringErrorsflag filteringtransaction.errorsinTransactionItemRowRBR(prior proposal): Rejected because it misses matching errors fromtransactionThreadActions, silently drops non-displayed string errors whenrejectErrorKeyor multiple distinct errors exist, and duplicatesMoneyRequestReportTransactionItem's error-selection logic. - Passing
shouldShowErrors={false}toTransactionItemRow: Rejected because it suppresses violations andmissingFieldErrorin report rows. - Removing
ErrorMessageRowfromMoneyRequestReportTransactionItem: Rejected because it removes the dismiss (X) button wired toclearErrorand breaks reject-error display.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01aee0111e1a0ae483
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
What is the root cause of that problem?
Each failed expense row in the report table shows transaction.errors in two places, and nothing stops them from showing the same message.
- The row's own error line.
MoneyRequestReportTransactionItemkeeps the string entries oftransaction.errors, picks the latest one, and renders it in<ErrorMessageRow>with the X. - The row's warning line. The
<TransactionItemRow>just above it uses the defaultshouldShowErrors = true, so the wide and narrow rows mountTransactionItemRowRBR. It callsgetRBRMessages, which runsextractErrorMessages(transaction.errors, …)and adds every string again.
The row's own error line was added in #92860 ("dismiss the failed expense row when the user dismisses the error message"). The warning line already showed transaction.errors, and it was not told to skip what the new line shows.
Proof from the bug video (about 1:56-2:00): each failed row has a small faded line inside the row (the warning line, faded by offlineFeedbackPending) and a second line under it with the X (the error line). Same expense, same text.
This is not new with #107654. The client error for a failed manual expense is already a plain translated string: getMicroSecondOnyxErrorWithTranslationKey returns translate(...), and it is written to transaction.errors by the failure data through getReceiptError. So any failed manual expense on this page shows its error twice, for example "Unexpected error submitting this expense. Please try again later." #107654 only made both lines carry the same server text (reconcileErrorsField also copies it into the scan's ReceiptError.message), which made it easy to see.
What changes do you think we should make in order to solve the problem?
Keep the row's error line as the single owner of the message it shows, because it has the dismiss X. Make the warning line skip exactly the text that the error line already shows. Everything else stays in the warning line.
- In
MoneyRequestReportTransactionItem, take the text that the error line shows fromtransactionErrors(its string values) and pass it toTransactionItemRowas a new optional prop, for exampleerrorMessagesShownInRow: string[]. - Pass the prop through
TransactionItemRow→ wide and narrow rows →DeferredTransactionItemRowRBR→TransactionItemRowRBR→getRBRMessages. Default is an empty list, so Search, Insights, Duplicate and Merge rows do not change. - In
getRBRMessages, afterextractErrorMessages, drop any message whose trimmed text is in that list:
errorMessages = extractErrorMessages(...)
.filter(message => !errorMessagesShownInRow.includes(message.trim()))
Why filter by text and not by error type:
- It removes all copies of the shown text in one place: the plain string, the scan's
ReceiptError.messagecopy, and a thread action error with the same text. - It keeps messages the error line does not show. The error line shows only the latest string, and when a reject error exists it shows only the reject message (L192-L193). Dropping all string errors from the warning line would make those messages disappear from the row.
- Violations, missing-field errors and the generic receipt failure text are not affected.
Tests:
- Add cases to
TransactionItemRowRBRTest: a shown message is skipped; a different string, a violation and a receipt error without a message still show. - Unit test for
getRBRMessageswith the new list. - QA: the steps in this issue (manual and scan each show the message once, X still clears it, scan keeps Try again / Save in the expense view), plus a failed manual expense with the generic error.
What alternative solutions did you explore? (Optional)
- Pass
shouldShowErrors={false}toTransactionItemRowfrom the report table. Rejected: it also hides violations and missing-field errors. - Remove
ErrorMessageRowand keep only the warning line. Rejected: it removes the X that clears the failed expense (#92860). - Drop every plain string error from the warning line. Rejected: it hides older errors and string errors on a row with a reject error, which the error line does not show.
- Fix it in
reconcileFailureDataWithServerErrors. Rejected: the data is already correct (one string per expense); the duplicate is in the view, and it also happens for the generic error that never goes through that helper.
@ShridharGoel can you check this?
Sure, this is an existing issue on prod as well
Proposal
What is the root cause of that problem?
On current main, MoneyRequestReportTransactionItem.tsx:197-201 already strips plain-string messageErrors from rowTransaction.errors, which fixes manual expenses. However, scanned receipt expenses still show "new expenses cannot be added to this report" twice:
reconcileFailureDataWithServerErrors.ts:21-22copies the server rejection string intoReceiptError.message, while the server'sonyxDataalso stores that same string intransaction.errors.MoneyRequestReportTransactionItem.tsx:198-201keeps all object entries inreceiptErrorsand passes them viarowTransactiontoTransactionItemRow.ViolationsUtils.ts:528-531readsReceiptError.messagefromrowTransaction.errors, soTransactionItemRowRBRrenders the exact same rejection message directly above<ErrorMessageRow>.
What changes do you think we should make in order to solve the problem?
In src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx:197-201:
- Collect the trimmed string error messages currently shown by
<ErrorMessageRow>(transactionErrors). - When building
receiptErrorsforrowTransaction, skip anyReceiptErrorwhosemessage?.trim()is already in that set. - Keep ordinary receipt upload errors (without a matching
ErrorMessageRowstring) unchanged, and add a unit test for the scanned-expense server rejection case.
What alternative solutions did you explore? (Optional)
- Removing
message: serverErrorfromreconcileFailureDataWithServerErrors.ts:22would regress views without a separate<ErrorMessageRow>(such as Search rows) that rely onReceiptError.message.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~019e72f237c6f31e66
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@ShridharGoel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!