Skip to content

[Due for payment 2026-03-19] Expense - Error when creating scan expense in self DM from quick action #85050

Closed

Description

@jponikarchuk

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.36-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84552
Email or phone of affected tester (no customers): sjodijsnodijdnoijsido@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:

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a scan expense.
  4. Open FAB.
  5. Click Scan receipt from Quick action.
  6. Upload a receipt.
  7. Select self DM.
  8. Click Create expense.

Expected Result:

Scan expense will be created in self DM without issue from QAB.

Actual Result:

Scan expense cannot be created in self DM from QAB.
"There was an error uploading your receipt" is shown.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    DeployBlockerCashThis issue or pull request should block deployment
    and removed
    DeployBlockerIndicates it should block deploying the API
    on Mar 12, 2026
  2. melvin-bot commented on Mar 12, 2026

    @melvin-bot

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

  3. melvin-bot commented on Mar 12, 2026

    @melvin-bot

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

  4. github-actions commented on Mar 12, 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. MelvinBot commented on Mar 12, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user goes to their self DM and uses the Quick Action Bar (QAB) scan receipt option from the FAB menu, then uploads a receipt and tries to create the expense, they see "There was an error uploading your receipt." The normal scan expense flow (not via QAB) works fine.

    What is the root cause of that problem?

    The QAB scan flow uses a different iouType (SUBMIT or TRACK) compared to the regular scan flow which uses CREATE. This difference, combined with the isFromFloatingActionButton flag, causes the post-scan routing logic in handleMoneyRequestStepScanParticipants to bypass both available "fast paths" and forces an extra navigation through the participants page.

    Specifically, in MoneyRequest.ts:371:

    if (!initialTransaction?.isFromGlobalCreate && !initialTransaction?.isFromFloatingActionButton && !isArchivedExpenseReport && iouType !== CONST.IOU.TYPE.CREATE) {

    When isFromFloatingActionButton=true, the entire "from report" fast-path is skipped. This path contains the shouldSkipConfirmation logic that would directly create the expense via createTransaction.

    Then at shouldUseDefaultExpensePolicy.ts:10:

    return iouType === CONST.IOU.TYPE.CREATE && ...

    Since QAB uses SUBMIT/TRACK (not CREATE), this also returns false.

    The flow falls through to navigateToParticipantPage(), adding an extra navigation step (scan → participants → confirmation) that doesn't exist in the regular CREATE flow.

    During this extra navigation, the receipt — stored as a blob:// URL in the transaction draft — must be re-read from memory when the confirmation page mounts. The confirmation page's useEffect (line ~521) calls validateReceiptFile → checkIfScanFileCanBeRead → readFileAsync, which does a fetch(blobUrl). If this fetch fails (blob invalidated during the extra navigation step), onFailure is triggered, which clears the receipt via setMoneyRequestReceipt(transactionID, '', '', true, '') and navigates the user back. Alternatively, if the receipt becomes empty but the API call still proceeds, the server returns an error that triggers the failureData containing the getReceiptError() receipt error message.

    In contrast, the regular scan flow (green receipt button / camera FAB) uses iouType=CREATE, which can take the shouldUseDefaultExpensePolicy path to auto-assign participants and navigate directly to confirmation — or even skip confirmation entirely, keeping the File object alive throughout the call chain without needing blob URL reconstruction.

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

    The QAB scan quick actions in QuickActionNavigation.ts should use CONST.IOU.TYPE.CREATE instead of CONST.IOU.TYPE.SUBMIT/CONST.IOU.TYPE.TRACK when calling startMoneyRequest for scan request types (REQUEST_SCAN and TRACK_SCAN). This aligns the QAB scan flow with the regular scan flow (green receipt button / camera FAB) which already uses CREATE.

    Specifically:

    • QuickActionNavigation.ts:49-53 (REQUEST_SCAN case): Change CONST.IOU.TYPE.SUBMIT → CONST.IOU.TYPE.CREATE
    • QuickActionNavigation.ts:66-68 (TRACK_SCAN case): Change CONST.IOU.TYPE.TRACK → CONST.IOU.TYPE.CREATE

    This would allow the shouldUseDefaultExpensePolicy check to pass, enabling the flow to auto-assign participants and go directly to confirmation (or skip it), avoiding the extra participants page navigation that causes the blob URL to become invalid.

    Similarly, the QAB fallback scan in FloatingActionButtonAndPopover.tsx:529 which also uses CONST.IOU.TYPE.SUBMIT should be changed to CONST.IOU.TYPE.CREATE for consistency with the green receipt button flow at line 370.

    What alternative solutions did you explore? (Optional)

    An alternative would be to preserve the File/Blob object across navigation (e.g., by storing it in a React context or module-level variable rather than relying on blob URL re-fetching). However, this is a more invasive change. Using CREATE type to match the existing working flow is simpler and more aligned with how the green receipt button already works.

    Another option would be to modify the condition at MoneyRequest.ts:371 to not skip the "from report" fast-path when isFromFloatingActionButton is true. However, the isFromFloatingActionButton guard was likely added intentionally to handle other cases, so changing the iouType is the safer approach.


    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.

  6. OSBotify commented on Mar 12, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #84552 - "[No QA] Re-add the "Sentry logs for Scan shortcut" after being reverted" by @cristipaval (High confidence)
    Related Issues: #83502

    Recommendation: REVERT

    PR #84552 should be reverted. The PR introduced the isFromFloatingActionButton flag to track telemetry for scan shortcuts, but it inadvertently broke the QAB scan flow by adding a condition that prevents QAB scan requests from taking the fast path to confirmation.

    Labels: No changes made. Keeping DeployBlockerCash as this is a frontend bug caused by an App PR that is reproducible on staging.

    📋 Detailed Analysis

    Evidence

    PR #84552 added the isFromFloatingActionButton flag and condition at line 371 of src/libs/actions/IOU/MoneyRequest.ts:

    if (!initialTransaction?.isFromGlobalCreate && !initialTransaction?.isFromFloatingActionButton && !isArchivedExpenseReport && iouType !== CONST.IOU.TYPE.CREATE) {

    This condition was intended to ensure the green receipt FAB flow (which uses CONST.IOU.TYPE.CREATE) does not take the "from report" fast path. However, the QAB scan actions use different IOU types:

    • REQUEST_SCAN uses CONST.IOU.TYPE.SUBMIT (line 52 of QuickActionNavigation.ts)
    • TRACK_SCAN uses CONST.IOU.TYPE.TRACK (line 68 of QuickActionNavigation.ts)

    Verification

    I verified that:

    1. PR [No QA] Re-add the "Sentry logs for Scan shortcut" after being reverted #84552 modified src/libs/actions/IOU/MoneyRequest.ts and added the isFromFloatingActionButton check
    2. The QAB implementation in src/libs/actions/QuickActionNavigation.ts uses CONST.IOU.TYPE.SUBMIT and CONST.IOU.TYPE.TRACK for scan requests
    3. The PR was merged on 2026-03-10 and is included in the 9.3.36-1 staging deploy
    4. The issue was reported as reproducible on staging but NOT on production (version 9.3.36-0)

    Root Cause

    When a user creates a scan expense from the QAB with isFromFloatingActionButton=true:

    1. The flow skips the "from report" fast-path at line 371 because isFromFloatingActionButton=true
    2. The flow also fails the shouldUseDefaultExpensePolicy check at line 523 because that requires iouType === CONST.IOU.TYPE.CREATE, but QAB uses SUBMIT or TRACK
    3. The code falls through to navigateToParticipantPage at line 554, adding an extra navigation step (scan → participants → confirmation)
    4. During this extra navigation, the receipt stored as a blob:// URL must be re-read from memory when the confirmation page mounts
    5. If the blob fetch fails (blob invalidated during navigation) or the receipt becomes empty, the error "There was an error uploading your receipt" is shown

    The regular scan flow (green receipt button) works because it uses iouType=CREATE, which can take the shouldUseDefaultExpensePolicy path and navigate directly to confirmation without the problematic extra navigation step.

  7. 2 remaining items

  8. cristipaval commented on Mar 12, 2026

    @cristipaval
    Contributor

    Thank you! Closing

  9. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Mar 12, 2026
  10. changed the title [-]Expense - Error when creating scan expense in self DM from quick action[/-] [+][Due for payment 2026-03-19] Expense - Error when creating scan expense in self DM from quick action[/+] on Mar 12, 2026
  11. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  12. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.36-10 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-03-19. 🎊

  13. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    @cristipaval 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]

  14. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions