Skip to content

[$250] [Exploratory] Add receipt - "Receipt upload failed" error after adding a receipt to a manual expense #90871

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.75-1
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://test-management.browserstack.com/projects/2219752/folder/13176933/test-cases/41237723
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: MacBook Air 15.7.4 Chrome, iPhone 15 iOS 26.4.2
App Component: Money Requests

Action Performed:

Preconditions: two accounts needed - User A and User B

  1. As User A, open chat with User B, send an expense with $20 amount
  2. As User B, open chat with User A, send an expense with a lower amount
  3. As User B, open the expense report, click on your expense
  4. Click "Add a receipt", upload any receipt
  5. Click back button to navigate to the report
  6. The error appears on the expense row with a receipt, open the expense
  7. Click "Delete expense"

Expected Result:

The receipt is added to a manual expense without an error

Actual Result:

Issue 1 - "There was an error uploading your receipt" is displayed on the expense row in report.
Issue 2 - "Receipt upload failed. Save the receipt, or delete the expense and lose it." is shown in the expense with the buttons "Save receipt" and "Delete expense". Nothing happens after clicking "Delete expense".
On Prod "Try again" is the second option instead of "Delete expense"

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

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @OlimpiaZurek

Activity

  1. antan2002 commented on May 16, 2026

    @antan2002

    Hi, I’d like to work on this issue. Could you please assign it to me?

  2. melvin-bot commented on May 16, 2026

    @melvin-bot

    📣 @antan2002! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  3. antan2002 commented on May 16, 2026

    @antan2002

    Contributor details

    Your Expensify account email: antanroy502@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0174aef847660818b7

    Hi, I’d like to work on this issue. Could you please assign it to me?

  4. melvin-bot commented on May 16, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  5. situchan commented on May 18, 2026

    @situchan
    Contributor

    cc: @mjasikowski @OlimpiaZurek for tracking

  6. situchan commented on Jun 1, 2026

    @situchan
    Contributor

    @mjasikowski @OlimpiaZurek What do you think about this issue?

  7. OlimpiaZurek commented on Jun 1, 2026

    @OlimpiaZurek
    Contributor

    If I understand this issue correctly, the bug is reproducible on both production and staging, the only difference is that since we introduced the new UI without the "Try again" button in #82139, staging now shows "Delete expense" where prod still shows "Try again." So we probably need to investigate why the error pops up in the first place, since that's the underlying bug. This doesn't look like a regression, that PR only changed the error-state UI, not the upload path itself.

  8. sandipanghos commented on Jun 2, 2026

    @sandipanghos

    @jponikarchuk
    Can I work in the issue?

  9. added
    Bug
    on Jul 17, 2026
  10. MelvinBot commented on Jul 17, 2026

    @MelvinBot
    Contributor

    Proposal

    This issue has two distinct problems. One is fixable in App; the other is a backend failure.

    What is the root cause of that problem?

    Issue 2 — "Delete expense" does nothing (App bug, fixable here):
    The "Delete expense" button in the receipt-error UI is wired to the generic dismiss-error handler, not a real delete. In DotIndicatorMessage.tsx:149-154 the button's onPress={dismissError}, which resolves to dismissReceiptError in MoneyRequestReceiptView.tsx:418-526. That handler only actually deletes the expense when transaction.pendingAction === ADD (i.e. the expense creation itself failed). Here the expense was created successfully and only the receipt attachment failed, so pendingAction !== ADD — the delete branch is skipped and the handler merely clears the error, leaving the expense in place. This is a regression from the new UI in #82139 (which replaced "Try again" with "Delete expense"), matching why prod still shows "Try again".

    Issue 1 — "There was an error uploading your receipt" (backend, not fixable in App):
    "Add a receipt" on an existing manual expense calls replaceReceipt(), which fires the ReplaceReceipt WRITE command (Receipt.ts:310). The error string is set only in that action's failureData — never optimistically — so its appearance means ReplaceReceipt genuinely returned a failure. The frontend is behaving correctly and displaying a real backend error. The root cause of Issue 1 is in the backend ReplaceReceipt command, which is outside the App repo — an internal engineer will need to investigate why it fails for this scenario (a manual expense on a 1:1 IOU report).

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

    For Issue 2 (App): Change the "Delete expense" button's onPress so it calls the real transaction-delete action (delete the money request unconditionally) instead of the dismiss-error handler. The button should remove the expense regardless of pendingAction.

    For Issue 1 (backend): Escalate to an internal engineer with access to the ReplaceReceipt Auth command to determine why the API rejects adding a receipt to a manual expense on a 1:1 IOU report. This requires production logs from a repro (capture the requestID and check the returned jsonCode/error for that ReplaceReceipt call).

    Investigation details & evidence

    Issue 2 path:

    • Buttons rendered at DotIndicatorMessage.tsx:140-156; "Delete expense" → onPress={dismissError}.
    • dismissError is passed through OfflineWithFeedback as dismissReceiptError from MoneyRequestReceiptView.tsx:610-643.
    • In dismissReceiptError, the only branch that calls cleanUpMoneyRequest (delete) is guarded by transaction?.pendingAction === RED_BRICK_ROAD_PENDING_ACTION.ADD. For a receipt-upload failure on an already-created expense, that guard is false, so only clearError/revert run — no deletion.

    Issue 1 path:

    • Entry point: MoneyRequestReceiptView.tsx:593-599 → scan step in EDIT mode → ScanEditReceipt.handleCapture calls replaceReceipt().
    • optimisticData sets errors: null; successData clears the pending flag; the error is set only in failureData via getReceiptError (Receipt.ts:216-254). So the error is a real API failure, not a stale optimistic error.
    • Strings: en.ts:1606-1608 (receiptFailureMessageShort = the row RBR, receiptUploadFailedMessage = inside the expense).

    Alternative considered: whether Issue 1 was a stale/optimistic error that never cleared — ruled out, since optimisticData explicitly resets errors: null on each attempt and successData would leave it null. The error only appears on a genuine failureData application.

    Confidence: High that Issue 2's button is mis-wired and that Issue 1 is a real backend ReplaceReceipt failure surfaced correctly by the frontend. Medium on the exact backend rejection reason (needs logs).

    Possibly related issues

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/90871) to create a draft PR (scoped to the Issue 2 "Delete expense" button fix only — Issue 1 needs a backend engineer).
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  11. 19 remaining items

  12. removed
    External
    Help Wanted
    on Jul 20, 2026
  13. added
    Weekly
    and removed
    Daily
    on Jul 20, 2026
  14. mjasikowski commented on Jul 20, 2026

    @mjasikowski
    Contributor

    @OlimpiaZurek since you have context, can you look into this please?

  15. OlimpiaZurek commented on Jul 21, 2026

    @OlimpiaZurek
    Contributor

    I checked this and was not able to reproduce it on the latest build.
    @jponikarchuk could you please retest this and confirm whether it's still reproducible? Thanks!

  16. jponikarchuk commented on Jul 21, 2026

    @jponikarchuk
    Author

    @OlimpiaZurek The issue is not repro on build 9.4.41-2

    Add.receipt.mp4
  17. mjasikowski commented on Jul 22, 2026

    @mjasikowski
    Contributor

    Thanks. I'll close this then.

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

Metadata

Metadata

Labels

BugNot a priorityWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions