Skip to content

Expense - "This field is required" error shows up on confirm page when submitting Scan expense #90651

Closed

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.74-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: #87920
Email or phone of affected tester (no customers): sdsdjoijdoisnjodis@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:

Precondition:

  • Run Onyx.merge('betas', ['newManualExpenseFlow']); in console.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Create expense > Scan.
  4. Upload a receipt.
  5. Click Create expense.

Expected Result:

Scan expense will be created.

Actual Result:

"This field is required" error shows up on confirm page when there is no required field.

This issue also happens when creating per diem expense.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7153937_1778757500958.9.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    on May 14, 2026
  2. melvin-bot commented on May 14, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #87920

  3. melvin-bot commented on May 14, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on May 14, 2026

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on May 14, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #87920 - "Feat: Manual expense flow UI refactor - r3" by @ChavdaSachin (High confidence)
    Related Issues: #82586

    Recommendation: REVERT

    PR #87920 introduced a validation guard that fires for all expense types (including scan and per diem) when the newManualExpenseFlow beta is enabled, even though the isAmountSet flag is only set via the manual amount entry path.

    Assigned: @ChavdaSachin (PR author), @ShridharGoel, @puneetlath (approving reviewers)
    Labels: No label changes needed — DeployBlockerCash is correct (frontend App PR caused the regression); DeployBlocker is not present.

    📋 Detailed Analysis

    Evidence

    Verification

    Root Cause

    PR #87920 added the following validation block to useConfirmationValidation.ts:

    if (isNewManualExpenseFlowEnabled && !transaction?.isAmountSet) {
      return { errorKey: "common.error.fieldRequired" };
    }

    isAmountSet is set to true only inside setMoneyRequestAmount(), which is called from the inline amount input in the new manual expense flow UI. For scan expenses, the amount comes from SmartScan (a different code path that does not call setMoneyRequestAmount with isAmountSet: true), so isAmountSet remains undefined. For per diem expenses, the amount is similarly calculated from sub-rates rather than set via the inline manual entry path. When either of these expense types reaches the confirm page, isAmountSet is falsy, the validation returns 'common.error.fieldRequired', and the UI displays "This field is required" — even though the amount field is not empty and is not required in the manual sense.

    The fix should either (a) skip the isAmountSet check when the expense is a scan or per diem request, or (b) ensure those code paths also set isAmountSet: true. Reverting PR #87920 is the safest and most straightforward resolution given the scope of the change.

  6. nlemma commented on May 14, 2026

    @nlemma
    Author

    Dupe of #90650

  7. MelvinBot commented on May 14, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The validation at useConfirmationValidation.ts:166-168 checks isAmountSet unconditionally for all expense types when the newManualExpenseFlow beta is enabled:

    if (isNewManualExpenseFlowEnabled && !transaction?.isAmountSet) {
        return {errorKey: 'common.error.fieldRequired'};
    }

    isAmountSet is only set to true when the user manually enters an amount via setMoneyRequestAmount. For scan expenses the amount comes from SmartScan (not user input), so isAmountSet is never set, and the validation incorrectly blocks submission. The same applies to per diem expenses where the amount is calculated from the subrate.

    Note that the existing validation on line 163 already correctly exempts scan, time, and distance requests — the new check at line 166 just missed the same guards.

    What changes do you think we should make in order to solve the problem?

    Add the same expense-type exemptions to the isAmountSet check that already exist on line 163. The condition should become:

    if (isNewManualExpenseFlowEnabled && !transaction?.isAmountSet && !isScanRequestUtil(transaction) && !isPerDiemRequest && !isTimeRequest && !isDistanceRequest)
    

    This ensures the "amount required" validation only applies to manual expense types where the user is expected to enter an amount themselves.

    Investigation details

    Data flow:

    1. User creates a scan expense → initMoneyRequest creates a transaction draft with amount: 0 and no isAmountSet property
    2. User uploads receipt → amount will come from SmartScan; setMoneyRequestAmount is never called
    3. User clicks "Create expense" → validate() at line 166 checks isAmountSet, finds it falsy, returns 'common.error.fieldRequired'
    4. AmountField at AmountField.tsx:96-104 renders the "This field is required" error

    Likely duplicate: #90650


    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.

  8. removed
    DeployBlockerCash
    on May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions