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-03-17] [$250] Scan - Save button loads infinitely when photo is cropped to the smallest size #83709
Version Number: 9.3.27-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:#81380 Email or phone of affected tester (no customers):osidnjodjosijsoji@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:
Open staging.new.expensify.com
Go to workspace chat.
Click + > Create expense > Scan.
Upload a photo.
On confirm page, click on the receipt.
Click Crop.
Crop it to the smallest and tap Save.
Repeat Step 6 to 7 a few times.
Expected Result:
Save button will not load infinitely when photo is cropped to the smallest.
Error should show up if the smallest size is not accepted.
Actual Result:
Save button loads infinitely when photo is cropped to the smallest.
👋 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.
Please re-state the problem that we are trying to solve in this issue.
When cropping a scanned receipt to the smallest possible size, the Save button loads infinitely. No error is shown to the user and there is no way to recover other than canceling out of the crop flow.
What is the root cause of that problem?
The cropOrRotateImage function (both web and native) wraps manipulateAsync inside a new Promise((resolve) => { ... }) with no reject parameter, and calls manipulateAsync(...).then(...) with no .catch().
When the user crops to the smallest size, the crop dimensions (in image coordinates) can become zero or near-zero due to floating-point arithmetic — the UI enforces a minimum of 24 display pixels (cornerHandleSize * 2), but after conversion to image coordinates via float multiplication, canvas operations can truncate these to 0. This causes expo-image-manipulator's CropAction to throw ERR_IMAGE_MANIPULATOR_CROP ("Crop size must be greater than 0"), or saveAsync to reject because canvas.toBlob() returns null on a zero-dimension canvas.
When manipulateAsync rejects, the .then() inside cropOrRotateImage is skipped, and the rejection goes unhandled inside the Promise constructor. Since the constructor only takes resolve (no reject), the outer promise never settles — it neither resolves nor rejects. This means saveCrop's .then() and .catch() in TransactionReceiptModalContent.tsx never fire, so setIsCropSaving(false) is never called, leaving the Save button in a permanent loading state.
What changes do you think we should make in order to solve the problem?
Two changes:
Fix the Promise constructor anti-pattern in cropOrRotateImage — In both src/libs/cropOrRotateImage/index.ts and src/libs/cropOrRotateImage/index.native.ts, refactor to use async/await (or add reject to the Promise constructor and .catch(reject) to the inner chains) so that errors from manipulateAsync properly propagate. This ensures saveCrop's .catch() fires and resets isCropSaving to false.
Add minimum crop dimension validation — In ReceiptCropView or in saveCrop, validate that the crop dimensions in image coordinates are at least 1 pixel (e.g., Math.max(1, Math.round(width))) before passing them to cropOrRotateImage. This prevents the crop from being attempted with zero dimensions in the first place.
What alternative solutions did you explore? (Optional)
Only adding validation without fixing the Promise: This would prevent the specific zero-dimension trigger, but other failures in manipulateAsync (e.g., network issues loading the image, out-of-memory) would still cause infinite loading. The Promise fix is essential.
Showing an error toast when crop dimensions are too small instead of attempting the crop: This would be a nice UX improvement but doesn't address the underlying Promise bug.
Note: The rotateReceipt function uses the same cropOrRotateImage path and has the identical vulnerability — if rotation fails, isRotating would also get stuck.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Issue is ready for payment but no BZ is assigned. @mallenexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Activity
melvin-bot commentedon Feb 27, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #81380
melvin-bot commentedon Feb 27, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 27, 2026
Triggered auto assignment to @bfitzexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.github-actions commentedon Feb 27, 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 Feb 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When cropping a scanned receipt to the smallest possible size, the Save button loads infinitely. No error is shown to the user and there is no way to recover other than canceling out of the crop flow.
What is the root cause of that problem?
The
cropOrRotateImagefunction (both web and native) wrapsmanipulateAsyncinside anew Promise((resolve) => { ... })with norejectparameter, and callsmanipulateAsync(...).then(...)with no.catch().When the user crops to the smallest size, the crop dimensions (in image coordinates) can become zero or near-zero due to floating-point arithmetic — the UI enforces a minimum of 24 display pixels (
cornerHandleSize * 2), but after conversion to image coordinates via float multiplication, canvas operations can truncate these to 0. This causesexpo-image-manipulator'sCropActionto throwERR_IMAGE_MANIPULATOR_CROP("Crop size must be greater than 0"), orsaveAsyncto reject becausecanvas.toBlob()returnsnullon a zero-dimension canvas.When
manipulateAsyncrejects, the.then()insidecropOrRotateImageis skipped, and the rejection goes unhandled inside the Promise constructor. Since the constructor only takesresolve(noreject), the outer promise never settles — it neither resolves nor rejects. This meanssaveCrop's.then()and.catch()inTransactionReceiptModalContent.tsxnever fire, sosetIsCropSaving(false)is never called, leaving the Save button in a permanent loading state.What changes do you think we should make in order to solve the problem?
Two changes:
Fix the Promise constructor anti-pattern in
cropOrRotateImage— In bothsrc/libs/cropOrRotateImage/index.tsandsrc/libs/cropOrRotateImage/index.native.ts, refactor to useasync/await(or addrejectto the Promise constructor and.catch(reject)to the inner chains) so that errors frommanipulateAsyncproperly propagate. This ensuressaveCrop's.catch()fires and resetsisCropSavingtofalse.Add minimum crop dimension validation — In
ReceiptCropViewor insaveCrop, validate that the crop dimensions in image coordinates are at least 1 pixel (e.g.,Math.max(1, Math.round(width))) before passing them tocropOrRotateImage. This prevents the crop from being attempted with zero dimensions in the first place.What alternative solutions did you explore? (Optional)
manipulateAsync(e.g., network issues loading the image, out-of-memory) would still cause infinite loading. The Promise fix is essential.Note: The
rotateReceiptfunction uses the samecropOrRotateImagepath and has the identical vulnerability — if rotation fails,isRotatingwould also get stuck.Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
52 remaining items
hungvu193 commentedon Mar 17, 2026
No checklist needed, this was caught by the regression test in #81380
trjExpensify commentedon Mar 17, 2026
We still fill out the checklist and do the other parts, like commenting on the PR that introduced the bug.
melvin-bot commentedon Mar 17, 2026
Issue is ready for payment but no BZ is assigned. @mallenexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
melvin-bot commentedon Mar 17, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
hungvu193 commentedon Mar 18, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/81380/changes#r2950559935
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
No regression test needed
mallenexpensify commentedon Mar 18, 2026
Payment Summary
Contributor: @hungvu193 paid $250 via Upwork
Contributor+: @eh2077 due $250 via NewDot
twisterdotcom commentedon Mar 19, 2026
@hungvu193 has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-12bb-a381-aac0-52ce93c44cd4JmillsExpensify commentedon Mar 24, 2026
$250 approved for @eh2077