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-05-11] [$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error #87047
Version Number: 9.3.52-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:#86622 Email or phone of affected tester (no customers):jsat+2abr@applausemail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Samsung Galaxy S21 Ultra/Android 15/Chrome, Macbook Pro/macOS 13.7.8/Chrome App Component: Other
Action Performed:
Launch Expensify App
Log in with valid credentials
Create a workspace
Create manual expense
Submit the expense
Reject the expense with reason <Shahrukh,khan>
Tap save
Expected Result:
The expense is rejected successfully and rejection reason is displayed properly.
Actual Result:
The expense is not rejected and rejection reason is not displayed properly
The report-level reject flow (rejectExpenseReport) sends the raw, unescaped comment to both the API and the optimistic report action. When the rejection reason contains angle brackets like <Shahrukh,khan>, the backend interprets it as an HTML tag and strips it (or rejects the request), causing the "Try again" error.
The transaction-level reject flow (prepareRejectMoneyRequestData) handles this correctly by calling getParsedComment(comment) which escapes < to < and > to > before sending to the API (IOU/index.ts:12242, IOU/index.ts:12924). The optimistic action builder for this flow also correctly uses getParsedComment for the html field (ReportUtils.ts:13104).
ReportUtils.ts:13177 uses raw comment as the html field in the optimistic action
What changes do you think we should make in order to solve the problem?
In rejectExpenseReport (IOU/index.ts), pass the comment through getParsedComment(comment) before sending it in the API parameters — matching the pattern at line 12924.
In buildOptimisticReportLevelRejectCommentAction (ReportUtils.ts:13177), change html: comment to html: getParsedComment(comment) — matching the pattern at line 13104.
What alternative solutions did you explore? (Optional)
Sanitizing at the form input level was considered but rejected — the escaping should happen at the API/rendering boundary, consistent with how the transaction-level flow already works. The correct pattern already exists in the codebase; it just needs to be applied consistently.
IOU/index.ts:12924: comment: parsedComment (in API params)
ReportUtils.ts:13104: html: getParsedComment(comment) (in optimistic action)
Buggy pattern (report-level reject):
IOU/index.ts:13964: comment, (raw, unescaped in API params)
ReportUtils.ts:13177: html: comment, (raw, unescaped in optimistic action)
getParsedComment calls Parser.replace with shouldEscapeText: true, which converts < to < and > to > via escapeText() in expensify-common.
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 [-]Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/-][+][$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/+]on Apr 3, 2026
Please re-state the problem that we are trying to solve in this issue.
When rejecting an expense report with a reason containing angle brackets (e.g. <Shahrukh,khan>), the rejection fails with a "Try again" error because the raw text is interpreted as HTML markup.
What is the root cause of that problem?
The RejectExpenseReportPage component at src/pages/RejectExpenseReportPage.tsx#L145-L148 passes the raw form value directly to rejectExpenseReport without first parsing/escaping the comment. Other form pages that accept free-text comments (e.g. TaskTitlePage, WorkspaceNewRoomPage, SplitExpenseEditPage) all call getParsedComment before passing user input downstream. The transaction-level rejection page (RejectReasonPage) doesn't have this issue because its downstream action (prepareRejectMoneyRequestData) calls getParsedComment internally — but the report-level path has no escaping at any layer.
What changes do you think we should make in order to solve the problem?
We should parse the comment in RejectExpenseReportPage.tsx before passing it to the action, consistent with how other form pages handle user text input. This is a single-file fix:
// src/pages/RejectExpenseReportPage.tsx// Add to imports:import{getParsedComment}from'@libs/ReportUtils';// In onSubmit, parse the comment before passing it:constonSubmit=(values: FormOnyxValues<typeofONYXKEYS.FORMS.REPORT_REJECT_FORM>)=>{// ... delegate check ...consttargetAccountID=hasPreviousApprover ? Number(selectedTargetAccountID) : submitterAccountID;if(!report){return;}constparsedComment=getParsedComment(values[INPUT_IDS.COMMENT]);rejectExpenseReport(report,targetAccountID,parsedComment,currentUserPersonalDetails?.accountID,currentUserPersonalDetails?.displayName,currentUserPersonalDetails?.avatar,);Navigation.goBack();};
This ensures angle brackets and other special characters are properly escaped to their HTML entities before reaching the API, matching the pattern used by TaskTitlePage, WorkspaceNewRoomPage, and SplitExpenseEditPage.
Please re-state the problem that we are trying to solve in this issue.
When rejecting an expense report with a reason containing angle brackets (e.g. <Shahrukh,khan>), the rejection fails with a "Try again" error and the reason is not displayed properly, because the raw text is interpreted as HTML markup.
What is the root cause of that problem?
The report-level reject flow sends the raw, unescaped comment to both the API and the optimistic report action. The transaction-level reject flow handles this correctly — it calls getParsedComment(comment) before sending to the API, and buildOptimisticRejectReportActionComment uses getParsedComment(comment) for the html field while keeping raw comment for the text field:
buildOptimisticReportLevelRejectCommentAction uses raw comment for the html field in the optimistic action message — the text field correctly stays as raw text, but html must be escaped:
What changes do you think we should make in order to solve the problem?
Fix at the action layer to match the existing transaction-level pattern:
In rejectExpenseReport (IOU/index.ts), pass the comment through getParsedComment(comment) in the API parameters — matching line 12924 where the transaction-level flow does the same.
In buildOptimisticReportLevelRejectCommentAction (ReportUtils.ts), change html: comment to html: getParsedComment(comment) — matching line 13104 where buildOptimisticRejectReportActionComment does the same. The text field must remain as the raw comment (plain text), while only html gets the parsed/escaped version.
This is important because the message object has two distinct fields: text (plain text for fallback/search) and html (HTML for rendering). Escaping must happen at this boundary to preserve both correctly.
What alternative solutions did you explore? (Optional)
Escaping at the page/form level (in RejectExpenseReportPage.tsx) was considered but rejected because it would pass the already-escaped HTML string as the comment parameter to rejectExpenseReport, which then flows into buildOptimisticReportLevelRejectCommentAction as the text field. This would corrupt the text field with HTML entities (e.g. <Shahrukh,khan> instead of <Shahrukh,khan>), breaking plain-text display and search. The correct pattern — used by the analogous transaction-level flow — is to escape inside the action/builder functions where text and html diverge.
changed the title [-][$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/-][+][Due for payment 2026-05-11] [$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/+]on May 4, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.65-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@linhvovan29546 / @truph01 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]
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: N/A — this is an edge case that’s part of the reject report project.
Link to the comment on the Issue: N/A — this is an edge case that’s part of the reject report project.
[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.
Activity
MelvinBot commentedon Apr 3, 2026
Proposal
What is the root cause of that problem?
The report-level reject flow (
rejectExpenseReport) sends the raw, unescaped comment to both the API and the optimistic report action. When the rejection reason contains angle brackets like<Shahrukh,khan>, the backend interprets it as an HTML tag and strips it (or rejects the request), causing the "Try again" error.The transaction-level reject flow (
prepareRejectMoneyRequestData) handles this correctly by callinggetParsedComment(comment)which escapes<to<and>to>before sending to the API (IOU/index.ts:12242,IOU/index.ts:12924). The optimistic action builder for this flow also correctly usesgetParsedCommentfor thehtmlfield (ReportUtils.ts:13104).The report-level flow skips this escaping:
IOU/index.ts:13964sends rawcommentto the APIReportUtils.ts:13177uses rawcommentas thehtmlfield in the optimistic actionWhat changes do you think we should make in order to solve the problem?
In
rejectExpenseReport(IOU/index.ts), pass the comment throughgetParsedComment(comment)before sending it in the API parameters — matching the pattern at line 12924.In
buildOptimisticReportLevelRejectCommentAction(ReportUtils.ts:13177), changehtml: commenttohtml: getParsedComment(comment)— matching the pattern at line 13104.What alternative solutions did you explore? (Optional)
Sanitizing at the form input level was considered but rejected — the escaping should happen at the API/rendering boundary, consistent with how the transaction-level flow already works. The correct pattern already exists in the codebase; it just needs to be applied consistently.
Evidence
Correct pattern (transaction-level reject):
IOU/index.ts:12242:const parsedComment = getParsedComment(comment);IOU/index.ts:12924:comment: parsedComment(in API params)ReportUtils.ts:13104:html: getParsedComment(comment)(in optimistic action)Buggy pattern (report-level reject):
IOU/index.ts:13964:comment,(raw, unescaped in API params)ReportUtils.ts:13177:html: comment,(raw, unescaped in optimistic action)getParsedCommentcallsParser.replacewithshouldEscapeText: true, which converts<to<and>to>viaescapeText()in expensify-common.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 3, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)melvin-bot commentedon Apr 3, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022039927148940725565
[-]Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/-][+][$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/+]trasnake87 commentedon Apr 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When rejecting an expense report with a reason containing angle brackets (e.g.
<Shahrukh,khan>), the rejection fails with a "Try again" error because the raw text is interpreted as HTML markup.What is the root cause of that problem?
The
RejectExpenseReportPagecomponent at src/pages/RejectExpenseReportPage.tsx#L145-L148 passes the raw form value directly torejectExpenseReportwithout first parsing/escaping the comment. Other form pages that accept free-text comments (e.g.TaskTitlePage,WorkspaceNewRoomPage,SplitExpenseEditPage) all callgetParsedCommentbefore passing user input downstream. The transaction-level rejection page (RejectReasonPage) doesn't have this issue because its downstream action (prepareRejectMoneyRequestData) callsgetParsedCommentinternally — but the report-level path has no escaping at any layer.What changes do you think we should make in order to solve the problem?
We should parse the comment in
RejectExpenseReportPage.tsxbefore passing it to the action, consistent with how other form pages handle user text input. This is a single-file fix:This ensures angle brackets and other special characters are properly escaped to their HTML entities before reaching the API, matching the pattern used by
TaskTitlePage,WorkspaceNewRoomPage, andSplitExpenseEditPage.trasnake87 commentedon Apr 3, 2026
Contributor details
Your Expensify account email: trasnake87@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656
melvin-bot commentedon Apr 3, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
wildan-m commentedon Apr 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When rejecting an expense report with a reason containing angle brackets (e.g.
<Shahrukh,khan>), the rejection fails with a "Try again" error and the reason is not displayed properly, because the raw text is interpreted as HTML markup.What is the root cause of that problem?
The report-level reject flow sends the raw, unescaped comment to both the API and the optimistic report action. The transaction-level reject flow handles this correctly — it calls
getParsedComment(comment)before sending to the API, andbuildOptimisticRejectReportActionCommentusesgetParsedComment(comment)for thehtmlfield while keeping rawcommentfor thetextfield:App/src/libs/actions/IOU/index.ts
Line 12242 in c530e02
App/src/libs/ReportUtils.ts
Lines 13100 to 13105 in c530e02
The report-level reject flow skips this escaping in two places:
rejectExpenseReportsends rawcommentto the API parameters — the backend interprets<Shahrukh,khan>as an HTML tag and rejects the request:App/src/libs/actions/IOU/index.ts
Lines 13961 to 13967 in c530e02
buildOptimisticReportLevelRejectCommentActionuses rawcommentfor thehtmlfield in the optimistic action message — thetextfield correctly stays as raw text, buthtmlmust be escaped:App/src/libs/ReportUtils.ts
Lines 13173 to 13178 in c530e02
What changes do you think we should make in order to solve the problem?
Fix at the action layer to match the existing transaction-level pattern:
In
rejectExpenseReport(IOU/index.ts), pass the comment throughgetParsedComment(comment)in the API parameters — matching line 12924 where the transaction-level flow does the same.In
buildOptimisticReportLevelRejectCommentAction(ReportUtils.ts), changehtml: commenttohtml: getParsedComment(comment)— matching line 13104 wherebuildOptimisticRejectReportActionCommentdoes the same. Thetextfield must remain as the rawcomment(plain text), while onlyhtmlgets the parsed/escaped version.This is important because the message object has two distinct fields:
text(plain text for fallback/search) andhtml(HTML for rendering). Escaping must happen at this boundary to preserve both correctly.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/87047-fix-reject-comment-escaping?expand=1
What alternative solutions did you explore? (Optional)
Escaping at the page/form level (in
RejectExpenseReportPage.tsx) was considered but rejected because it would pass the already-escaped HTML string as thecommentparameter torejectExpenseReport, which then flows intobuildOptimisticReportLevelRejectCommentActionas thetextfield. This would corrupt thetextfield with HTML entities (e.g.<Shahrukh,khan>instead of<Shahrukh,khan>), breaking plain-text display and search. The correct pattern — used by the analogous transaction-level flow — is to escape inside the action/builder functions wheretextandhtmldiverge.wildan-m commentedon Apr 3, 2026
Proposal
Updated
Added compare branch with implementation.
61 remaining items
[-][$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/-][+][Due for payment 2026-05-11] [$250] Expense - Unable to reject expense with reason <Shahrukh,khan> and "Try again" error[/+]melvin-bot commentedon May 4, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 4, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.65-6 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-11. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon May 4, 2026
@linhvovan29546 / @truph01 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 May 7, 2026
@linhvovan29546 Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon May 10, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)linhvovan29546 commentedon May 11, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: N/A — this is an edge case that’s part of the reject report project.
Link to the comment on the Issue: N/A — this is an edge case that’s part of the reject report project.
[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:
Regression Test Proposal
Test:
N/A — we already have a regression test for this https://github.com/Expensify/Expensify/issues/625221
Do we agree 👍 or 👎
mallenexpensify commentedon May 11, 2026
Payment Summary
Contributor: @linhvovan29546 paid $250 via Upwork
Contributor+: @truph01 due $250 via NewDot
Thx!