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-08-28] Please enter a valid merchant violation remains when change to IOU #96593
👋 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: #96228 - "feat: remove isNewManualExpenseFlowEnabled beta flag" by @thelullabyy (High confidence) Related Issues: #93854 (the tracking issue the PR was made for)
Recommendation: REVERT
This PR removed the isNewManualExpenseFlowEnabled beta flag, making the refactored "new manual expense flow" the default on staging. That flow contains the merchant-error clearing logic that fails to re-clear iou.error.invalidMerchant when the recipient switches from a workspace (merchant required) to an individual/IOU (merchant not required). The flow is still beta-gated in production, which is exactly why this reproduces on staging only. Reverting restores the beta gate and unblocks the deploy; the underlying flow can then be fixed and re-shipped.
Assigned: @thelullabyy (PR author), @joekaufmanexpensify, @ikevin127, @puneetlath (approving reviewers) from highest-confidence causing PR only Labels: No changes. DeployBlockerCash kept (App deploy is blocked by an App PR); no DeployBlocker present.
📋 Detailed Analysis
Evidence
Bug is reproducible on staging but NOT production (per the report). The new manual expense flow is still beta-gated in production and only became the default on staging because of this PR, so the bug surface only exists on staging — a textbook signature of this exact PR.
src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts — owns isMerchantRequired, isMerchantFieldValid, and the effect that is supposed to clear the iou.error.invalidMerchant form error.
src/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts — sets iou.error.invalidMerchant when isMerchantRequired && !isMerchantFieldValid.
src/components/MoneyRequestConfirmationList.tsx, src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx, src/pages/iou/request/step/IOURequestStepParticipants.tsx — confirmation list + merchant field + participant switching.
src/CONST/index.ts — removes the beta flag constant.
gh pr view 96228 --json files confirms all of the above are in the diff.
Root Cause
In useFormErrorManagement.ts:
isMerchantRequired = isPolicyExpenseChat && (!isScanRequest || !!isEditingSplitBill) && shouldShowMerchant (line 161). Switching the recipient to an individual makes isPolicyExpenseChat false, so merchant is no longer required.
isMerchantFieldValid returns !isMerchantRequired when the merchant value is empty (line 172), so after the switch it should become true.
The effect at lines 211–214 is meant to clear the error: if (currentFormError === 'iou.error.invalidMerchant' && isMerchantFieldValid) setFormError('').
The error persists because that clearing effect does not reliably re-run/re-clear when only the participant changes (the merchant string itself never changes; the requirement changes). There is a dedicated effect in MoneyRequestConfirmationList.tsx (lines 399–404) that clears iou.error.noParticipantSelected on participant change, but there is no equivalent path to clear iou.error.invalidMerchant when the participant change flips the merchant-required state. So the stale merchant error set during the workspace attempt remains after switching to an IOU.
A targeted fix would clear/re-evaluate the merchant form error whenever isMerchantRequired changes (e.g. add isMerchantRequired to the clearing logic or clear iou.error.invalidMerchant in the participant-change effect). REVERT is recommended for the deploy because the flow is beta-gated in production and reverting cleanly restores that gate without risk.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.41-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@ikevin127 / @thelullabyy 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]. If no checklist is needed for this issue, you can click: [no checklist button]
@ikevin127 / @thelullabyy 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]. If no checklist is needed for this issue, you can click: [no checklist button]
Root cause: In the new manual-expense flow, isMerchantFieldValid never flips to true after you switch the recipient to an individual, so the stale iou.error.invalidMerchant never clears and the confirm handler keeps bailing out.
A manual expense carries the sentinel merchant "Expense" (getMerchant → transaction.merchant). In useFormErrorManagement.ts:166-180 the !trimmedMerchant branch only handles a truly empty string, so the non-empty "Expense" sentinel skips it and falls through to !isInvalidMerchantValue("Expense") → false. Because isMerchantFieldValid stays false, the clear-effect at lines 205-210 never fires when merchant stops being required, and confirmAction.ts:98-101 early-returns on the stale error.
The fix: treat the sentinel/blank merchant values ("", "(none)", "Expense") as "blank" so validity returns !isMerchantRequired. When the recipient switches to an individual, isMerchantRequired → false, so isMerchantFieldValid → true, the clear-effect fires, formError clears, and submit proceeds. This is the only behavior change — a not-required blank/sentinel merchant now counts as valid; every required-merchant case is unchanged.
Patch
Save this as fix-merchant-error.patch in the repo root and apply with git apply fix-merchant-error.patch:
diff --git a/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts b/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts
index fc87e43..69c2b19 100644
--- a/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts+++ b/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts@@ -172,11 +172,15 @@ function useFormErrorManagement({
return false;
}
- if (!trimmedMerchant) {+ // A blank merchant — empty, or one of the sentinel placeholders ("Expense", "(none)") that stand in for+ // "no merchant yet" — is only invalid while the merchant is required. Once the recipient switches to an+ // individual (merchant no longer required) it becomes valid, which lets the clearing effect drop a stale+ // `iou.error.invalidMerchant` error instead of leaving it stuck on screen.+ if (isInvalidMerchantValue(trimmedMerchant)) {
return !isMerchantRequired;
}
- return !isInvalidMerchantValue(trimmedMerchant);+ return true;
})();
const isViolationFixed = getIsViolationFixed(formError, {
Note: since PR #96228 was reverted, the new flow is beta-gated again behind newManualExpenseFlow. To repro/test you'll need that beta enabled. This patch is the targeted fix to fold into the re-land of #96228.
How to verify
Enable the newManualExpenseFlow beta.
FAB → Create expense → enter amount → Create expense (with a workspace recipient) → confirm the "Please enter a valid merchant" violation shows.
Change the receiver to an individual (your own email) → Create expense.
Expected with the patch: the merchant error clears and the IOU expense is created.
Next Steps: Reply with @MelvinBot implement this to have me open a draft PR with this fix, or @MelvinBot <feedback> to refine.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.57-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-08-28. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]
changed the title [-][Due for payment 2026-07-29] Please enter a valid merchant violation remains when change to IOU[/-][+][Due for payment 2026-08-28] Please enter a valid merchant violation remains when change to IOU[/+]on Aug 21, 2026
Activity
applause-bot commentedon Jul 21, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/9530d2233b97866efb89951b8498261dafb50654248b15b8b9a9248183d7766d
melvin-bot commentedon Jul 21, 2026
Triggered auto assignment to @jasperhuangg (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Jul 21, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jul 21, 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:
MelvinBot commentedon Jul 21, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #96228 - "feat: remove isNewManualExpenseFlowEnabled beta flag" by @thelullabyy (High confidence)
Related Issues: #93854 (the tracking issue the PR was made for)
Recommendation: REVERT
This PR removed the
isNewManualExpenseFlowEnabledbeta flag, making the refactored "new manual expense flow" the default on staging. That flow contains the merchant-error clearing logic that fails to re-cleariou.error.invalidMerchantwhen the recipient switches from a workspace (merchant required) to an individual/IOU (merchant not required). The flow is still beta-gated in production, which is exactly why this reproduces on staging only. Reverting restores the beta gate and unblocks the deploy; the underlying flow can then be fixed and re-shipped.Assigned: @thelullabyy (PR author), @joekaufmanexpensify, @ikevin127, @puneetlath (approving reviewers) from highest-confidence causing PR only
Labels: No changes.
DeployBlockerCashkept (App deploy is blocked by an App PR); noDeployBlockerpresent.📋 Detailed Analysis
Evidence
Verification
Affected files, all modified by #96228:
src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts— ownsisMerchantRequired,isMerchantFieldValid, and the effect that is supposed to clear theiou.error.invalidMerchantform error.src/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts— setsiou.error.invalidMerchantwhenisMerchantRequired && !isMerchantFieldValid.src/components/MoneyRequestConfirmationList.tsx,src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx,src/pages/iou/request/step/IOURequestStepParticipants.tsx— confirmation list + merchant field + participant switching.src/CONST/index.ts— removes the beta flag constant.gh pr view 96228 --json filesconfirms all of the above are in the diff.Root Cause
In
useFormErrorManagement.ts:isMerchantRequired = isPolicyExpenseChat && (!isScanRequest || !!isEditingSplitBill) && shouldShowMerchant(line 161). Switching the recipient to an individual makesisPolicyExpenseChatfalse, so merchant is no longer required.isMerchantFieldValidreturns!isMerchantRequiredwhen the merchant value is empty (line 172), so after the switch it should becometrue.if (currentFormError === 'iou.error.invalidMerchant' && isMerchantFieldValid) setFormError('').The error persists because that clearing effect does not reliably re-run/re-clear when only the participant changes (the merchant string itself never changes; the requirement changes). There is a dedicated effect in
MoneyRequestConfirmationList.tsx(lines 399–404) that clearsiou.error.noParticipantSelectedon participant change, but there is no equivalent path to cleariou.error.invalidMerchantwhen the participant change flips the merchant-required state. So the stale merchant error set during the workspace attempt remains after switching to an IOU.A targeted fix would clear/re-evaluate the merchant form error whenever
isMerchantRequiredchanges (e.g. addisMerchantRequiredto the clearing logic or cleariou.error.invalidMerchantin the participant-change effect). REVERT is recommended for the deploy because the flow is beta-gated in production and reverting cleanly restores that gate without risk.32 remaining items
melvin-bot commentedon Jul 22, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.41-4 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-07-29. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 22, 2026
@ikevin127 / @thelullabyy 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]. If no checklist is needed for this issue, you can click: [no checklist button]
melvin-bot commentedon Jul 22, 2026
@ikevin127 / @thelullabyy 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]. If no checklist is needed for this issue, you can click: [no checklist button]
thelullabyy commentedon Jul 29, 2026
@MelvinBot Please investigate and give me patch file to test your fix solution
MelvinBot commentedon Jul 29, 2026
Fix patch to test
Root cause: In the new manual-expense flow,
isMerchantFieldValidnever flips totrueafter you switch the recipient to an individual, so the staleiou.error.invalidMerchantnever clears and the confirm handler keeps bailing out.A manual expense carries the sentinel merchant
"Expense"(getMerchant→transaction.merchant). InuseFormErrorManagement.ts:166-180the!trimmedMerchantbranch only handles a truly empty string, so the non-empty"Expense"sentinel skips it and falls through to!isInvalidMerchantValue("Expense")→false. BecauseisMerchantFieldValidstaysfalse, the clear-effect at lines 205-210 never fires when merchant stops being required, andconfirmAction.ts:98-101early-returns on the stale error.The fix: treat the sentinel/blank merchant values (
"","(none)","Expense") as "blank" so validity returns!isMerchantRequired. When the recipient switches to an individual,isMerchantRequired→false, soisMerchantFieldValid→true, the clear-effect fires,formErrorclears, and submit proceeds. This is the only behavior change — a not-required blank/sentinel merchant now counts as valid; every required-merchant case is unchanged.Patch
Save this as
fix-merchant-error.patchin the repo root and apply withgit apply fix-merchant-error.patch:How to verify
newManualExpenseFlowbeta.Next Steps: Reply with
@MelvinBot implement thisto have me open a draft PR with this fix, or@MelvinBot <feedback>to refine.melvin-bot commentedon Aug 21, 2026
@ikevin127 / @thelullabyy
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.57-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-08-28. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]
[-][Due for payment 2026-07-29] Please enter a valid merchant violation remains when change to IOU[/-][+][Due for payment 2026-08-28] Please enter a valid merchant violation remains when change to IOU[/+]ikevin127 commentedon Aug 22, 2026
❌ No payment due here as this was a regression of a PR we're working on merging via multiple batch PRs.