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-07] [Due for payment 2026-03-30] Web - User receives an error message while scanning a receipt. The expense is not created. #85755
Version Number: 9.3.40-4 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/13176925/test-cases/41237598 Email or phone of affected tester (no customers):fischer9966+notif@gmail.com Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: MacOS 26.3.1 / Chrome, Safari App Component: Money Requests
Action Performed:
Login to staging.new.expensify.com with any account
Go to any 1:1 chat
Click + > Create expense
Click "Choose files" and select receipt from computer
Click "Create expense"
Expected Result:
Expense is created from receipt image from computer
Actual Result:
User receives an error message while scanning a receipt image from computer. The expense is not created.
👋 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: #70740 - "refactor: Improve and simplify attachment and file validation" by @chrispader (High confidence) Related Issues: None found
Recommendation: REVERT
PR #70740 introduced a memory leak in the receipt upload flow that causes scanning to fail. The PR should be reverted to unblock the deploy.
Labels: This is a frontend bug (App PR caused the issue). Keeping DeployBlockerCash label as appropriate. The DeployBlocker label should be removed if present since this is not a backend issue.
Detailed Analysis
Evidence
PR #70740 was merged on 2026-03-18 12:16:24 UTC and is in the current staging deploy (9.3.40-4). The issue only reproduces on staging (not production), which aligns with this PR being newly deployed to staging.
The PR refactored attachment validation by introducing a new file src/libs/validateAttachmentFile.ts. This file contains logic that creates object URLs for uploaded files.
Verification
I examined the receipt upload flow and found the following files are involved:
The first object URL is never revoked with URL.revokeObjectURL(), causing a memory leak
When the browser runs out of memory for blob URLs, the receipt scan fails with an error
This is a classic object URL memory leak. Each createObjectURL allocates memory in the browser that must be manually freed with revokeObjectURL. By creating two URLs but only using the second one, the first leaks memory.
Please re-state the problem that we are trying to solve in this issue.
When creating an expense from a 1:1 chat by clicking + > Create expense > Choose files > selecting a receipt image > Create expense, the user receives an error message and the expense is not created. This is reproducible on staging (v9.3.40-4) but not production.
What is the root cause of that problem?
Causing PR:#70740 — "refactor: Improve and simplify attachment and file validation"
This PR refactored the entire attachment/file validation pipeline (useFilesValidation.tsx, new validateAttachmentFile.ts, AttachmentUtils.ts, FileUtils.ts), which is the exact code path receipts go through when uploaded from a file picker on web. Two related deploy blockers confirm PR #70740 as the source:
hasHeicOrHeifExtension returns false (not null/undefined) for JPG/PNG files. The ?? (nullish coalescing) operator only falls through for null/undefined, NOT false. So false ?? Str.isImage(...) evaluates to false. This means all non-HEIC images are misidentified as non-images, making the resize-on-error path dead code for standard receipt photos (JPG, PNG).
Images bypass the size check in validateAttachmentFile.ts:32-35:
The !isImage condition means recognized images never get FILE_TOO_LARGE, so they pass validation regardless of size. Combined with bug Some initial fixes and code style updates #1, large images that previously got resized now go directly to upload at full size, potentially causing server-side rejection.
New FILE_INVALID early-exit check at validateAttachmentFile.ts:20-22:
This check did not exist in the old code. While standard browser File objects always have name and size, edge cases with custom FileObject wrappers could be silently rejected.
What changes do you think we should make in order to solve the problem?
A revert PR is already open: #85752 — "Revert: refactor: Improve and simplify attachment and file validation". This should be merged to unblock the deploy.
If a targeted fix is preferred instead of a full revert, the minimum change is at src/hooks/useFilesValidation.tsx line 35 — change ?? to ||:
What alternative solutions did you explore? (Optional)
The ?? to || fix addresses the isImageFile bug but may not fix all issues introduced by the broader refactor (the "No content to add" error from #85671 may have a separate mechanism within the same PR). The full revert via #85752 is the safer option for unblocking the deploy.
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.
I ran out of time before I could finish helping you. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in the #melvinbot-ai.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.41-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@mjasikowski 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]
changed the title [-][Due for payment 2026-03-30] Web - User receives an error message while scanning a receipt. The expense is not created.[/-][+][Due for payment 2026-05-07] [Due for payment 2026-03-30] Web - User receives an error message while scanning a receipt. The expense is not created.[/+]on Apr 30, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.64-31 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@mjasikowski@mallenexpensify 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]
Activity
melvin-bot commentedon Mar 19, 2026
Triggered auto assignment to @mjasikowski (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Mar 19, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 19, 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:
OSBotify commentedon Mar 19, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #70740 - "refactor: Improve and simplify attachment and file validation" by @chrispader (High confidence)
Related Issues: None found
Recommendation: REVERT
PR #70740 introduced a memory leak in the receipt upload flow that causes scanning to fail. The PR should be reverted to unblock the deploy.
Labels: This is a frontend bug (App PR caused the issue). Keeping
DeployBlockerCashlabel as appropriate. TheDeployBlockerlabel should be removed if present since this is not a backend issue.Detailed Analysis
Evidence
PR #70740 was merged on 2026-03-18 12:16:24 UTC and is in the current staging deploy (9.3.40-4). The issue only reproduces on staging (not production), which aligns with this PR being newly deployed to staging.
The PR refactored attachment validation by introducing a new file
src/libs/validateAttachmentFile.ts. This file contains logic that creates object URLs for uploaded files.Verification
I examined the receipt upload flow and found the following files are involved:
src/pages/iou/request/step/IOURequestStepScan/components/DesktopWebUploadView.tsx- Handles file upload UIsrc/libs/validateAttachmentFile.ts- New file added in PR refactor: Improve and simplify attachment and file validation #70740 that validates attachmentsBoth files create object URLs for the same file, causing a double allocation.
Root Cause
When a user uploads a receipt from their computer on web:
DesktopWebUploadView.tsxline 63 creates an object URL:The file is then passed to validation, which calls the new
validateAttachmentFile.tsvalidateAttachmentFile.tsline 73-74 creates a SECOND object URL and overwrites the first:The first object URL is never revoked with
URL.revokeObjectURL(), causing a memory leakWhen the browser runs out of memory for blob URLs, the receipt scan fails with an error
This is a classic object URL memory leak. Each
createObjectURLallocates memory in the browser that must be manually freed withrevokeObjectURL. By creating two URLs but only using the second one, the first leaks memory.MelvinBot commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an expense from a 1:1 chat by clicking + > Create expense > Choose files > selecting a receipt image > Create expense, the user receives an error message and the expense is not created. This is reproducible on staging (v9.3.40-4) but not production.
What is the root cause of that problem?
Causing PR: #70740 — "refactor: Improve and simplify attachment and file validation"
This PR refactored the entire attachment/file validation pipeline (
useFilesValidation.tsx, newvalidateAttachmentFile.ts,AttachmentUtils.ts,FileUtils.ts), which is the exact code path receipts go through when uploaded from a file picker on web. Two related deploy blockers confirm PR #70740 as the source:The specific code issues introduced by PR #70740:
??vs||bug inisImageFileatsrc/hooks/useFilesValidation.tsx:35:hasHeicOrHeifExtensionreturnsfalse(notnull/undefined) for JPG/PNG files. The??(nullish coalescing) operator only falls through fornull/undefined, NOTfalse. Sofalse ?? Str.isImage(...)evaluates tofalse. This means all non-HEIC images are misidentified as non-images, making the resize-on-error path dead code for standard receipt photos (JPG, PNG).Images bypass the size check in
validateAttachmentFile.ts:32-35:The
!isImagecondition means recognized images never getFILE_TOO_LARGE, so they pass validation regardless of size. Combined with bug Some initial fixes and code style updates #1, large images that previously got resized now go directly to upload at full size, potentially causing server-side rejection.New
FILE_INVALIDearly-exit check atvalidateAttachmentFile.ts:20-22:This check did not exist in the old code. While standard browser
Fileobjects always havenameandsize, edge cases with customFileObjectwrappers could be silently rejected.What changes do you think we should make in order to solve the problem?
A revert PR is already open: #85752 — "Revert: refactor: Improve and simplify attachment and file validation". This should be merged to unblock the deploy.
If a targeted fix is preferred instead of a full revert, the minimum change is at
src/hooks/useFilesValidation.tsxline 35 — change??to||:What alternative solutions did you explore? (Optional)
The
??to||fix addresses theisImageFilebug but may not fix all issues introduced by the broader refactor (the "No content to add" error from #85671 may have a separate mechanism within the same PR). The full revert via #85752 is the safer option for unblocking the deploy.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.MelvinBot commentedon Mar 19, 2026
I ran out of time before I could finish helping you. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in the #melvinbot-ai.
Run details: https://github.com/Expensify/Expensify/actions/runs/23290154068
mjasikowski commentedon Mar 19, 2026
@chrispader is working on a fix in #85751
chrispader commentedon Mar 19, 2026
This actually seems to be coming from recent Onyx bump to version
3.0.46. We're discussing next steps in this Slack thread right now13 remaining items
melvin-bot commentedon Mar 23, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 23, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.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-03-30. 🎊
melvin-bot commentedon Mar 23, 2026
@mjasikowski 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 Mar 23, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)[-][Due for payment 2026-03-30] Web - User receives an error message while scanning a receipt. The expense is not created.[/-][+][Due for payment 2026-05-07] [Due for payment 2026-03-30] Web - User receives an error message while scanning a receipt. The expense is not created.[/+]melvin-bot commentedon Apr 30, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Apr 30, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.64-31 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-07. 🎊
melvin-bot commentedon Apr 30, 2026
@mjasikowski @mallenexpensify 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]