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
[$175] Let the user recover from every failed receipt or expense request #106966
changed the title [-]Let the user recover from every failed receipt or expense request[/-][+][$175] Let the user recover from every failed receipt or expense request[/+]on Nov 16, 2026
Confidence: Medium. Source inspection supports all three recovery gaps. No runtime reproduction was performed; production logs were unavailable, so the reported ~190 dropped requests/day remains unverified.
What is the root cause of that problem?
These are three distinct gaps, rather than one broken retry button:
Web retry is intentionally disabled and incomplete. The browser file resolver cannot recover a receipt. Simply enabling the button would not work; create/track retry payloads also need to preserve the actual browser File.
Receipt failures lose the server’s explanation. Failure data is built before the response arrives, and the receipt-error UI displays generic upload copy rather than the specific reason.
JSON 426 does not guarantee recoverable retention. Upgrade handling returns a resolved response, after which the queue removes the request. Failure data normally still runs, but the browser’s upgrade navigation is not coordinated with durable recovery storage.
Payload compatibility:buildRetryPayload.ts:78–100 spreads the receipt into a plain object, whereas browser upload validation requires a Blob. This is a latent web-enablement problem, not evidence of broken native uploads.
Upgrade recovery is not guaranteed:UpdateRequired/index.ts:18–48 can initiate navigation before downstream recovery completes. PersistedRequests.ts:390–417 explicitly skips persisting an ongoing request containing top-level File/Blob values.
Challenge result: It would be incorrect to say every 426 skips rollback or leaves no error. Failure data normally applies. The demonstrated defect is the absence of a guaranteed durable recovery handoff; actual loss depends on payload and navigation timing.
What changes do you think we should make in order to solve the problem?
Complete browser retry: resolve readable receipt bytes, preserve File/Blob identity, and reuse existing expense/action IDs. Show an actionable fallback when the file is unavailable.
Preserve the server reason: carry a user-safe message/code alongside receipt-recovery metadata and render it with generic fallback.
Make 426 recovery durable before navigation or dequeue: retain expense inputs and either durable receipt bytes or an explicit file-reselection path. Keep failed requests out of the runnable queue so unrelated work can continue.
Required regression coverage: real browser-file multipart retry; missing/revoked files; server-reason rendering; 426 recovery across reload; unrelated queue progress; and duplicate prevention.
What alternative solutions did you explore? (Optional)
Only enable the retry flag: insufficient—the resolver and payload construction also need changes.
Automatically retry 426 with normal backoff: an unchanged app version cannot resolve an upgrade requirement.
Keep 426 at the queue head indefinitely: risks blocking unrelated requests.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/106966) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
There are three specific root causes preventing users from recovering from failed requests:
Web retry is completely disabled and unimplemented:
In src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, web hardcodes:
constisRetrySupported=false;
And src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts simply returns Promise.resolve(undefined). While native resolves durable files from ReceiptStorage, web treats all blob URLs as irrecoverable. However, during an active browser session (without a full page refresh), the blob URL is still valid in memory and can be converted back to a File/Blob via fetch(blobUrl).then(r => r.blob()). Because isRetrySupported is hardcoded to false, web users are never offered the "Try again" retry option.
Server's specific error message is discarded in favor of generic copy:
In src/libs/actions/OnyxUpdates.ts:76–118, when an API request fails, the client applies the pre-constructed optimistic failureData. Even though the server response contains a specific error message (response.message), the client overwrites the error with static generic translation keys (e.g. iou.error.genericCreateFailureMessage / iou.error.receiptFailureMessage). The user only sees a vague "Unexpected error" message instead of the actionable server reason.
HTTP / JSON 426 silently deletes queued requests from SequentialQueue:
In src/libs/HttpUtils.ts:245–256, when the backend returns a 426 (Update Required), the response promise is resolved rather than rejected. Consequently, in src/libs/Network/SequentialQueue.ts:486–490:
Log.info('[SequentialQueue] Removing persisted request because it was processed successfully.',false,{command: requestToProcess.command,remainingRequests: getAllPersistedRequests().length,});endPersistedRequestAndRemoveFromQueue(requestToProcess);
SequentialQueue treats the resolved 426 as a successfully completed request and permanently removes it from PersistedRequests (endPersistedRequestAndRemoveFromQueue). When the user refreshes or upgrades the app, their queued expense and receipt request is completely gone, causing ~190 dropped requests per day.
What changes do you think we should make in order to solve the problem?
Enable receipt upload retry on web:
In src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, enable retry support (isRetrySupported = true).
In src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts, implement browser resolution:
Check if the receipt's local source is an active blob URL or data URI.
If valid, retrieve the blob data via fetch(source).then(res => res.blob()) and reconstruct a uploadable File object (new File([blob], filename, {type: blob.type})).
If the blob URL has been revoked or expired (e.g. following a hard reload), gracefully display an inline CTA prompting the user to re-select the receipt file instead of silently blocking retry.
Surface actual server error message in OnyxUpdates.ts:
In src/libs/actions/OnyxUpdates.ts (when applying failureData):
Check if response?.message or response?.error is provided in the server response payload.
If present, dynamically merge the server's specific error message into the transaction's errors or errorFields alongside the standard error structure, allowing DotIndicatorMessage.tsx and MoneyRequestReceiptView.tsx to render the exact server rejection reason.
Preserve queued requests on 426 (Update Required):
In src/libs/Network/SequentialQueue.ts:
Inspect response?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED (or HTTP status 426).
When a 426 is received, pause the queue (pause()) and trigger the update flow WITHOUT calling endPersistedRequestAndRemoveFromQueue(requestToProcess).
Leave the request safely persisted in PersistedRequests. Once the app updates and reboots, SequentialQueue will resume and execute the queued request with the updated client version.
What alternative solutions did you explore? (Optional)
We explored keeping 426 requests active in the immediate retry loop with exponential backoff. However, because an older client version cannot satisfy a 426 upgrade requirement without code updates, immediate retrying would waste bandwidth and cause rate limiting. Pausing the queue and keeping the request persisted until the app reboots on the new version guarantees zero data loss without spamming the server.
Please re-state the problem that we are trying to solve in this issue.
When a queued receipt or expense request fails, users cannot recover in three common situations:
On web, the receipt retry button ("Try again") never appears because isRetrySupported is hardcoded to false (src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts), even when the receipt's blob: URL is still alive in the current browser session (ReceiptStorage.resolve(source)).
When the server returns a specific error message (response.message), applyHTTPSOnyxUpdates (src/libs/actions/OnyxUpdates.ts:94-112) applies the pre-baked client request.failureData (which contains generic fallback messages like iou.error.genericCreateFailureMessage / iou.error.receiptFailureMessage), discarding the server's real error message unless the server explicitly returned it inside response.onyxData.
When the server replies with 426 (CONST.JSON_CODE.UPDATE_REQUIRED), HttpUtils.ts:245-256 resolves the promise (after calling alertUser()), and SequentialQueue.ts:486-490 treats that resolved 426 response as a completed request and calls endPersistedRequestAndRemoveFromQueue(requestToProcess), silently deleting ~190 queued receipt and expense requests per day before the user updates the app.
What is the root cause of that problem?
isRetrySupported.ts and resolveReceiptFile.ts disable web receipt retries entirely:
However, src/libs/ReceiptStorage/index.ts already tracks valid session blob: URLs in sessionLocalSources via ReceiptStorage.retain(source) and ReceiptStorage.resolve(source). As long as the document has not reloaded, ReceiptStorage.resolve(source) returns the live blob: URL, which can be fetched via fetch(resolvedSource).then((r) => r.blob()) to reconstruct the File object (new File([blob], filename, {type: blob.type || getMimeTypeFromUri(filename)})).
OnyxUpdates.ts (applyHTTPSOnyxUpdates) overwrites / ignores response.message when applying request.failureData:
In src/libs/actions/OnyxUpdates.ts#L94-L113, when response.jsonCode !== 200 && request.failureData, applyHTTPSOnyxUpdates logs response.message to trackExpenseApiError (line 107) and then applies request.failureData unchanged.
Because request.failureData was built before the request was sent, its errors / errorFields entries contain generic client-side translation strings (or ReceiptError with no server message), so the user never sees response.message.
SequentialQueue.ts:486-490 removes the request from PersistedRequests even when response?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED (426):
In src/libs/HttpUtils.ts#L245-L256, response.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED triggers alertUser() and resolves response.
Next, in src/libs/actions/OnyxUpdates.ts:94, response.jsonCode !== 200 would also apply request.failureData unless 426 is skipped!
Then, in src/libs/Network/SequentialQueue.ts#L486-L490, process() unconditionally calls endPersistedRequestAndRemoveFromQueue(requestToProcess) and continues draining the queue (return process()), wiping out every queued request in PERSISTED_REQUESTS while the app is waiting to be updated.
What changes do you think we should make in order to solve the problem?
Make the retry button work on web (isRetrySupported.ts, resolveReceiptFile.ts, canBuildRetryPayload):
In src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, set const isRetrySupported = true (or check !!ReceiptStorage.resolve(context.receiptError.source) in isRetryableFlow and canBuildReplaceReceiptRetryPayload so the retry button is shown on web whenever the blob: URL is still active in ReceiptStorage.resolve(source)).
In src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts, resolve the blob: URL through ReceiptStorage.resolve(source) and reconstruct the File:
Show the server's real error message instead of a generic one (src/libs/actions/OnyxUpdates.ts and ErrorMessageRow / ReceiptError):
In src/libs/actions/OnyxUpdates.ts inside applyHTTPSOnyxUpdates (lines 94-112), when response.jsonCode !== 200 && request.failureData:
If typeof response.message === 'string' && response.message.trim().length > 0, map over request.failureData and replace generic fallback error strings in value.errors and value.errorFields (and attach message: response.message on ReceiptError objects, rendered in ErrorMessageRow.tsx) with {[timestamp]: response.message} so the user sees the server's real error message while preserving ReceiptError.retryParams for the retry button.
Do not drop or roll back the queued request when the server replies 426 (SequentialQueue.ts & OnyxUpdates.ts):
In src/libs/actions/OnyxUpdates.ts:94, do not apply request.failureData when Number(response.jsonCode) === CONST.JSON_CODE.UPDATE_REQUIRED (426), because the request has not failed—it must remain in its optimistic/queued state until the client updates.
In src/libs/Network/SequentialQueue.ts:479-491, before calling endPersistedRequestAndRemoveFromQueue(requestToProcess), check if Number(response?.jsonCode) === CONST.JSON_CODE.UPDATE_REQUIRED:
When 426 is received, keep requestToProcess in PERSISTED_REQUESTS (re-insert/rollback ongoingRequest back to the front of persistedRequests or pause before removing it), call pause(), and return without calling endPersistedRequestAndRemoveFromQueue(requestToProcess) or process(). Once the user updates and reloads the app, SequentialQueue will replay the preserved request on the new build.
What alternative solutions did you explore? (Optional)
Pausing SequentialQueue on 426 without also skipping request.failureData in OnyxUpdates.ts and without keeping ongoingRequest in persistedRequests: rejected because PersistedRequests.processNextRequest() already shifted requestToProcess out of ONYXKEYS.PERSISTED_REQUESTS into RAM-only ongoingRequest (PersistedRequests.ts:138), and OnyxUpdates.ts runs in SaveResponseInOnyx middleware beforeSequentialQueue.ts:480. Thus, both skipping failureData on 426 in OnyxUpdates.ts and restoring ongoingRequest to the front of PERSISTED_REQUESTS (via rollbackOngoingRequest()) before pause() in SequentialQueue.ts are required so the request survives the app reload triggered by the update!
A user whose receipt or expense request fails cannot always recover:
On web, a failed receipt upload cannot be retried at all.
When an expense request fails, the user sees a generic message instead of
the server's actual reason.
When the server answers 426 (update required), the queued expense is
silently discarded even though nothing about the expense itself failed.
Root cause
Web retry is disabled by a blanket ban.isRetrySupported on web
(src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts) hardcodes false - "Web only has the receipt as a blob URL, which is gone after a
reload, so there is nothing to resend" - and the web resolveReceiptFile.ts returns undefined unconditionally. Both retry
payload builders bail on the flag (buildRetryPayload.ts:27, buildReplaceReceiptRetryPayload.ts:46). The reasoning only covers the
AFTER-RELOAD case. Within the same session the blob URL is still alive and
fetchable, so the recoverable case is banned along with the unrecoverable
one.
The server's message never reaches the user. In applyHTTPSOnyxUpdates (src/libs/actions/OnyxUpdates.ts:94-111), response.message is in scope at the exact point request.failureData is
applied - trackExpenseApiError already records it for telemetry - but the
user only ever sees the generic error that was baked into the failure data
when the request was enqueued, before the server had said anything.
A 426 reads as success to the queue.HttpUtils.ts:245-256 RESOLVES
(does not reject) on CONST.JSON_CODE.UPDATE_REQUIRED (426) after calling alertUser(). SequentialQueue's .then handler then removes the request
unconditionally (lines 486-490, "Removing persisted request because it was
processed successfully"). The handler does know how to pause - it checks response?.shouldPauseQueue at line 481 - but a 426 response never sets
it, and removal happens regardless. The expense is deleted from the queue
for an app-version problem that has nothing to do with the expense.
Changes
Web retry - implement resolveReceiptFile and lift the ban.
src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts (web):
implement the existing ResolveReceiptFile type - fetch(source),
convert the blob to a File with the stored filename, return it. If the
fetch fails (the blob is gone, e.g. after a reload), return undefined.
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts (web): export true. The builders already gate on isLocalFile(source) and already
handle an unresolved file by falling back to asking the user to pick the
receipt again - so after a reload the flow degrades to "re-select the
receipt" instead of "no retry exists". Native files are untouched (the
native isRetrySupported is already true and the native resolveReceiptFile already works).
Surface the server's message. In applyHTTPSOnyxUpdates, in the jsonCode !== 200 && request.failureData branch, when ALL of these hold:
the command is an expense or receipt write command, the request carries a transactionID, and response.message is non-empty - append one extra
update to the batch applied with the failure data: a MERGE on the
transaction key setting errors from the server message (microsecond
Onyx error format, same as other transaction errors). The injection
respects the existing 460 ADMIN_REQUIRED skip: when failure data is not
applied, no message is injected either. Non-expense commands are
untouched, so no other flow's error surface changes.
A 426 pauses the queue and KEEPS the request.
HttpUtils.ts: on the non-prefetched UPDATE_REQUIRED path, in addition
to alertUser(), mark the resolved response shouldPauseQueue = true -
the flag SequentialQueue already honours.
SequentialQueue.ts.then handler: when response?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED, pause, and
return WITHOUT removing the request, WITHOUT committing queueFlushedData, and WITHOUT applying failure data. The expense is
not failed; it is deferred. After the user updates and the app relaunches,
the persisted request replays through the normal flush and the receipt
uploads with no user action.
Not changed: native retry behaviour, the update-required modal itself
(alertUser), the OpenApp failure modal logic, the 460 handling, and the
telemetry in trackExpenseApiError (it keeps recording the message; the user
now sees it too).
Tests
tests/unit/ReceiptUploadRetryHandlerTest.ts (exists): on web, resolveReceiptFile returns a File for a live blob URL and undefined
for a dead one; buildRetryPayload now proceeds on web for a local source
and falls back cleanly when the file cannot be resolved.
OnyxUpdates tests: a failed expense command with a server message applies
the failure data AND the server-message error on the transaction; a
non-expense command does not; a 460 response injects nothing.
tests/unit/SequentialQueueTest.ts: a 426 response leaves the request in
the persisted queue and the queue paused, applies no failure data, and the
same request is sent after a simulated relaunch; a 200 response still
removes the request (regression control).
Alternatives considered
Re-upload the server's copy of the receipt on web. Rejected: there is
no server copy - the upload is what failed.
Bake a better generic message into the failure data. Rejected: the
server's reason does not exist at enqueue time; no static text can
substitute for it.
Treat 426 like a failure and apply failure data. Rejected: the expense
would show an error for an app-version problem, and on web the receipt blob
would be gone after the forced update, making the expense unrecoverable -
the opposite of this issue's goal.
Pause the queue for every non-200. Rejected: ordinary failures should
keep their current apply-failure-data-and-continue behaviour; only 426
means "this client must stop and upgrade".
Proposal updated: please review this version of my proposal above (#106966 (comment)), reformatted into the official template. The solution and scope are unchanged.
Please re-state the problem that we are trying to solve in this issue.
A user whose receipt or expense request fails cannot always recover:
On web, a failed receipt upload cannot be retried at all.
When an expense request fails, the user sees a generic message instead of
the server's actual reason.
When the server answers 426 (update required), the queued expense is
silently discarded even though nothing about the expense itself failed.
What is the root cause of that problem?
Web retry is disabled by a blanket ban.isRetrySupported on web
(src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts) hardcodes false - "Web only has the receipt as a blob URL, which is gone after a
reload, so there is nothing to resend" - and the web resolveReceiptFile.ts returns undefined unconditionally. Both retry
payload builders bail on the flag (buildRetryPayload.ts:27, buildReplaceReceiptRetryPayload.ts:46). The reasoning only covers the
AFTER-RELOAD case. Within the same session the blob URL is still alive and
fetchable, so the recoverable case is banned along with the unrecoverable
one.
The server's message never reaches the user. In applyHTTPSOnyxUpdates (src/libs/actions/OnyxUpdates.ts:94-111), response.message is in scope at the exact point request.failureData is
applied - trackExpenseApiError already records it for telemetry - but the
user only ever sees the generic error that was baked into the failure data
when the request was enqueued, before the server had said anything.
A 426 reads as success to the queue.HttpUtils.ts:245-256 RESOLVES
(does not reject) on CONST.JSON_CODE.UPDATE_REQUIRED (426) after calling alertUser(). SequentialQueue's .then handler then removes the request
unconditionally (lines 486-490, "Removing persisted request because it was
processed successfully"). The handler does know how to pause - it checks response?.shouldPauseQueue at line 481 - but a 426 response never sets
it, and removal happens regardless. The expense is deleted from the queue
for an app-version problem that has nothing to do with the expense.
What changes do you think we should make in order to solve the problem?
Web retry - implement resolveReceiptFile and lift the ban.
src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts (web):
implement the existing ResolveReceiptFile type - fetch(source),
convert the blob to a File with the stored filename, return it. If the
fetch fails (the blob is gone, e.g. after a reload), return undefined.
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts (web): export true. The builders already gate on isLocalFile(source) and already
handle an unresolved file by falling back to asking the user to pick the
receipt again - so after a reload the flow degrades to "re-select the
receipt" instead of "no retry exists". Native files are untouched (the
native isRetrySupported is already true and the native resolveReceiptFile already works).
Surface the server's message. In applyHTTPSOnyxUpdates, in the jsonCode !== 200 && request.failureData branch, when ALL of these hold:
the command is an expense or receipt write command, the request carries a transactionID, and response.message is non-empty - append one extra
update to the batch applied with the failure data: a MERGE on the
transaction key setting errors from the server message (microsecond
Onyx error format, same as other transaction errors). The injection
respects the existing 460 ADMIN_REQUIRED skip: when failure data is not
applied, no message is injected either. Non-expense commands are
untouched, so no other flow's error surface changes.
A 426 pauses the queue and KEEPS the request.
HttpUtils.ts: on the non-prefetched UPDATE_REQUIRED path, in addition
to alertUser(), mark the resolved response shouldPauseQueue = true -
the flag SequentialQueue already honours.
SequentialQueue.ts.then handler: when response?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED, pause, and
return WITHOUT removing the request, WITHOUT committing queueFlushedData, and WITHOUT applying failure data. The expense is
not failed; it is deferred. After the user updates and the app relaunches,
the persisted request replays through the normal flush and the receipt
uploads with no user action.
Not changed: native retry behaviour, the update-required modal itself
(alertUser), the OpenApp failure modal logic, the 460 handling, and the
telemetry in trackExpenseApiError (it keeps recording the message; the user
now sees it too).
Tests:
tests/unit/ReceiptUploadRetryHandlerTest.ts (exists): on web, resolveReceiptFile returns a File for a live blob URL and undefined
for a dead one; buildRetryPayload now proceeds on web for a local source
and falls back cleanly when the file cannot be resolved.
OnyxUpdates tests: a failed expense command with a server message applies
the failure data AND the server-message error on the transaction; a
non-expense command does not; a 460 response injects nothing.
tests/unit/SequentialQueueTest.ts: a 426 response leaves the request in
the persisted queue and the queue paused, applies no failure data, and the
same request is sent after a simulated relaunch; a 200 response still
removes the request (regression control).
What alternative solutions did you explore? (Optional)
Re-upload the server's copy of the receipt on web. Rejected: there is
no server copy - the upload is what failed.
Bake a better generic message into the failure data. Rejected: the
server's reason does not exist at enqueue time; no static text can
substitute for it.
Treat 426 like a failure and apply failure data. Rejected: the expense
would show an error for an app-version problem, and on web the receipt blob
would be gone after the forced update, making the expense unrecoverable -
the opposite of this issue's goal.
Pause the queue for every non-200. Rejected: ordinary failures should
keep their current apply-failure-data-and-continue behaviour; only 426
means "this client must stop and upgrade".
@Pujan92@mountiny@adhorodyski this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Activity
expensify-chore-bot commentedon Nov 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 (
External)[-]Let the user recover from every failed receipt or expense request[/-][+][$175] Let the user recover from every failed receipt or expense request[/+]expensify-chore-bot commentedon Nov 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022122192866791055815
MelvinBot commentedon Nov 16, 2026
Proposal
Confidence: Medium. Source inspection supports all three recovery gaps. No runtime reproduction was performed; production logs were unavailable, so the reported ~190 dropped requests/day remains unverified.
What is the root cause of that problem?
These are three distinct gaps, rather than one broken retry button:
File.426does not guarantee recoverable retention. Upgrade handling returns a resolved response, after which the queue removes the request. Failure data normally still runs, but the browser’s upgrade navigation is not coordinated with durable recovery storage.Code evidence and important qualifications
isRetrySupported.ts:1–4disables support;resolveReceiptFile.ts:1–6always returns no file.buildRetryPayload.ts:78–100spreads the receipt into a plain object, whereas browser upload validation requires aBlob. This is a latent web-enablement problem, not evidence of broken native uploads.OnyxUpdates.ts:76–118applies prebuilt failure data;DotIndicatorMessage.tsx:132–190selects generic receipt text.HttpUtils.ts:245–256prompts for an update but resolves;SequentialQueue.ts:479–508removes resolved requests.UpdateRequired/index.ts:18–48can initiate navigation before downstream recovery completes.PersistedRequests.ts:390–417explicitly skips persisting an ongoing request containing top-levelFile/Blobvalues.Challenge result: It would be incorrect to say every 426 skips rollback or leaves no error. Failure data normally applies. The demonstrated defect is the absence of a guaranteed durable recovery handoff; actual loss depends on payload and navigation timing.
What changes do you think we should make in order to solve the problem?
File/Blobidentity, and reuse existing expense/action IDs. Show an actionable fallback when the file is unavailable.Required regression coverage: real browser-file multipart retry; missing/revoked files; server-reason rendering; 426 recovery across reload; unrelated queue progress; and duplicate prevention.
What alternative solutions did you explore? (Optional)
Related: Error message persists and expense not completed on tapping Try again CTA discusses permanent server rejections, but its native reproduction is not established as the same defect.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/106966)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
kevinjosh10 commentedon Nov 16, 2026
Proposal
What is the root cause of that problem?
There are three specific root causes preventing users from recovering from failed requests:
In
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, web hardcodes:And
src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.tssimply returnsPromise.resolve(undefined). While native resolves durable files fromReceiptStorage, web treats all blob URLs as irrecoverable. However, during an active browser session (without a full page refresh), the blob URL is still valid in memory and can be converted back to aFile/Blobviafetch(blobUrl).then(r => r.blob()). BecauseisRetrySupportedis hardcoded tofalse, web users are never offered the "Try again" retry option.Server's specific error message is discarded in favor of generic copy:
In
src/libs/actions/OnyxUpdates.ts:76–118, when an API request fails, the client applies the pre-constructed optimisticfailureData. Even though the server response contains a specific error message (response.message), the client overwrites the error with static generic translation keys (e.g.iou.error.genericCreateFailureMessage/iou.error.receiptFailureMessage). The user only sees a vague "Unexpected error" message instead of the actionable server reason.HTTP / JSON 426 silently deletes queued requests from
SequentialQueue:In
src/libs/HttpUtils.ts:245–256, when the backend returns a 426 (Update Required), the response promise is resolved rather than rejected. Consequently, insrc/libs/Network/SequentialQueue.ts:486–490:SequentialQueuetreats the resolved 426 as a successfully completed request and permanently removes it fromPersistedRequests(endPersistedRequestAndRemoveFromQueue). When the user refreshes or upgrades the app, their queued expense and receipt request is completely gone, causing ~190 dropped requests per day.What changes do you think we should make in order to solve the problem?
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, enable retry support (isRetrySupported = true).src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts, implement browser resolution:sourceis an active blob URL or data URI.fetch(source).then(res => res.blob())and reconstruct a uploadableFileobject (new File([blob], filename, {type: blob.type})).OnyxUpdates.ts:src/libs/actions/OnyxUpdates.ts(when applyingfailureData):response?.messageorresponse?.erroris provided in the server response payload.errorsorerrorFieldsalongside the standard error structure, allowingDotIndicatorMessage.tsxandMoneyRequestReceiptView.tsxto render the exact server rejection reason.src/libs/Network/SequentialQueue.ts:response?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED(or HTTP status 426).pause()) and trigger the update flow WITHOUT callingendPersistedRequestAndRemoveFromQueue(requestToProcess).PersistedRequests. Once the app updates and reboots,SequentialQueuewill resume and execute the queued request with the updated client version.What alternative solutions did you explore? (Optional)
Contributor Details:
cocvn157 commentedon Nov 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a queued receipt or expense request fails, users cannot recover in three common situations:
isRetrySupportedis hardcoded tofalse(src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts), even when the receipt'sblob:URL is still alive in the current browser session (ReceiptStorage.resolve(source)).response.message),applyHTTPSOnyxUpdates(src/libs/actions/OnyxUpdates.ts:94-112) applies the pre-baked clientrequest.failureData(which contains generic fallback messages likeiou.error.genericCreateFailureMessage/iou.error.receiptFailureMessage), discarding the server's real error message unless the server explicitly returned it insideresponse.onyxData.426(CONST.JSON_CODE.UPDATE_REQUIRED),HttpUtils.ts:245-256resolves the promise (after callingalertUser()), andSequentialQueue.ts:486-490treats that resolved426response as a completed request and callsendPersistedRequestAndRemoveFromQueue(requestToProcess), silently deleting ~190 queued receipt and expense requests per day before the user updates the app.What is the root cause of that problem?
isRetrySupported.tsandresolveReceiptFile.tsdisable web receipt retries entirely:src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts,isRetrySupportedisfalse, andsrc/libs/ReceiptUploadRetryHandler/resolveReceiptFile.tsreturnsPromise.resolve(undefined).src/libs/ReceiptStorage/index.tsalready tracks valid sessionblob:URLs insessionLocalSourcesviaReceiptStorage.retain(source)andReceiptStorage.resolve(source). As long as the document has not reloaded,ReceiptStorage.resolve(source)returns the liveblob:URL, which can be fetched viafetch(resolvedSource).then((r) => r.blob())to reconstruct theFileobject (new File([blob], filename, {type: blob.type || getMimeTypeFromUri(filename)})).OnyxUpdates.ts(applyHTTPSOnyxUpdates) overwrites / ignoresresponse.messagewhen applyingrequest.failureData:src/libs/actions/OnyxUpdates.ts#L94-L113, whenresponse.jsonCode !== 200 && request.failureData,applyHTTPSOnyxUpdateslogsresponse.messagetotrackExpenseApiError(line 107) and then appliesrequest.failureDataunchanged.request.failureDatawas built before the request was sent, itserrors/errorFieldsentries contain generic client-side translation strings (orReceiptErrorwith no server message), so the user never seesresponse.message.SequentialQueue.ts:486-490removes the request fromPersistedRequestseven whenresponse?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED(426):src/libs/HttpUtils.ts#L245-L256,response.jsonCode === CONST.JSON_CODE.UPDATE_REQUIREDtriggersalertUser()and resolvesresponse.src/libs/actions/OnyxUpdates.ts:94,response.jsonCode !== 200would also applyrequest.failureDataunless426is skipped!src/libs/Network/SequentialQueue.ts#L486-L490,process()unconditionally callsendPersistedRequestAndRemoveFromQueue(requestToProcess)and continues draining the queue (return process()), wiping out every queued request inPERSISTED_REQUESTSwhile the app is waiting to be updated.What changes do you think we should make in order to solve the problem?
Make the retry button work on web (
isRetrySupported.ts,resolveReceiptFile.ts,canBuildRetryPayload):src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts, setconst isRetrySupported = true(or check!!ReceiptStorage.resolve(context.receiptError.source)inisRetryableFlowandcanBuildReplaceReceiptRetryPayloadso the retry button is shown on web whenever theblob:URL is still active inReceiptStorage.resolve(source)).src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts, resolve theblob:URL throughReceiptStorage.resolve(source)and reconstruct theFile:Show the server's real error message instead of a generic one (
src/libs/actions/OnyxUpdates.tsandErrorMessageRow/ReceiptError):src/libs/actions/OnyxUpdates.tsinsideapplyHTTPSOnyxUpdates(lines 94-112), whenresponse.jsonCode !== 200 && request.failureData:typeof response.message === 'string' && response.message.trim().length > 0, map overrequest.failureDataand replace generic fallback error strings invalue.errorsandvalue.errorFields(and attachmessage: response.messageonReceiptErrorobjects, rendered inErrorMessageRow.tsx) with{[timestamp]: response.message}so the user sees the server's real error message while preservingReceiptError.retryParamsfor the retry button.Do not drop or roll back the queued request when the server replies
426(SequentialQueue.ts&OnyxUpdates.ts):src/libs/actions/OnyxUpdates.ts:94, do not applyrequest.failureDatawhenNumber(response.jsonCode) === CONST.JSON_CODE.UPDATE_REQUIRED(426), because the request has not failed—it must remain in its optimistic/queued state until the client updates.src/libs/Network/SequentialQueue.ts:479-491, before callingendPersistedRequestAndRemoveFromQueue(requestToProcess), check ifNumber(response?.jsonCode) === CONST.JSON_CODE.UPDATE_REQUIRED:426is received, keeprequestToProcessinPERSISTED_REQUESTS(re-insert/rollbackongoingRequestback to the front ofpersistedRequestsor pause before removing it), callpause(), and return without callingendPersistedRequestAndRemoveFromQueue(requestToProcess)orprocess(). Once the user updates and reloads the app,SequentialQueuewill replay the preserved request on the new build.What alternative solutions did you explore? (Optional)
SequentialQueueon426without also skippingrequest.failureDatainOnyxUpdates.tsand without keepingongoingRequestinpersistedRequests: rejected becausePersistedRequests.processNextRequest()already shiftedrequestToProcessout ofONYXKEYS.PERSISTED_REQUESTSinto RAM-onlyongoingRequest(PersistedRequests.ts:138), andOnyxUpdates.tsruns inSaveResponseInOnyxmiddleware beforeSequentialQueue.ts:480. Thus, both skippingfailureDataon426inOnyxUpdates.tsand restoringongoingRequestto the front ofPERSISTED_REQUESTS(viarollbackOngoingRequest()) beforepause()inSequentialQueue.tsare required so the request survives the app reload triggered by the update!dankezo commentedon Nov 16, 2026
Contributor details
Your Expensify account email: dannyphan190@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013b564a690d9bcdab
Proposal
Problem
A user whose receipt or expense request fails cannot always recover:
the server's actual reason.
silently discarded even though nothing about the expense itself failed.
Root cause
Web retry is disabled by a blanket ban.
isRetrySupportedon web(
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts) hardcodesfalse- "Web only has the receipt as a blob URL, which is gone after areload, so there is nothing to resend" - and the web
resolveReceiptFile.tsreturnsundefinedunconditionally. Both retrypayload builders bail on the flag (
buildRetryPayload.ts:27,buildReplaceReceiptRetryPayload.ts:46). The reasoning only covers theAFTER-RELOAD case. Within the same session the blob URL is still alive and
fetchable, so the recoverable case is banned along with the unrecoverable
one.
The server's message never reaches the user. In
applyHTTPSOnyxUpdates(src/libs/actions/OnyxUpdates.ts:94-111),response.messageis in scope at the exact pointrequest.failureDataisapplied -
trackExpenseApiErroralready records it for telemetry - but theuser only ever sees the generic error that was baked into the failure data
when the request was enqueued, before the server had said anything.
A 426 reads as success to the queue.
HttpUtils.ts:245-256RESOLVES(does not reject) on
CONST.JSON_CODE.UPDATE_REQUIRED(426) after callingalertUser(). SequentialQueue's.thenhandler then removes the requestunconditionally (lines 486-490, "Removing persisted request because it was
processed successfully"). The handler does know how to pause - it checks
response?.shouldPauseQueueat line 481 - but a 426 response never setsit, and removal happens regardless. The expense is deleted from the queue
for an app-version problem that has nothing to do with the expense.
Changes
Web retry - implement
resolveReceiptFileand lift the ban.src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts(web):implement the existing
ResolveReceiptFiletype -fetch(source),convert the blob to a
Filewith the stored filename, return it. If thefetch fails (the blob is gone, e.g. after a reload), return
undefined.src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts(web): exporttrue. The builders already gate onisLocalFile(source)and alreadyhandle an unresolved file by falling back to asking the user to pick the
receipt again - so after a reload the flow degrades to "re-select the
receipt" instead of "no retry exists". Native files are untouched (the
native
isRetrySupportedis alreadytrueand the nativeresolveReceiptFilealready works).Surface the server's message. In
applyHTTPSOnyxUpdates, in thejsonCode !== 200 && request.failureDatabranch, when ALL of these hold:the command is an expense or receipt write command, the request carries a
transactionID, andresponse.messageis non-empty - append one extraupdate to the batch applied with the failure data: a MERGE on the
transaction key setting
errorsfrom the server message (microsecondOnyx error format, same as other transaction errors). The injection
respects the existing 460 ADMIN_REQUIRED skip: when failure data is not
applied, no message is injected either. Non-expense commands are
untouched, so no other flow's error surface changes.
A 426 pauses the queue and KEEPS the request.
HttpUtils.ts: on the non-prefetched UPDATE_REQUIRED path, in additionto
alertUser(), mark the resolved responseshouldPauseQueue = true-the flag SequentialQueue already honours.
SequentialQueue.ts.thenhandler: whenresponse?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED, pause, andreturn WITHOUT removing the request, WITHOUT committing
queueFlushedData, and WITHOUT applying failure data. The expense isnot failed; it is deferred. After the user updates and the app relaunches,
the persisted request replays through the normal flush and the receipt
uploads with no user action.
Not changed: native retry behaviour, the update-required modal itself
(
alertUser), the OpenApp failure modal logic, the 460 handling, and thetelemetry in
trackExpenseApiError(it keeps recording the message; the usernow sees it too).
Tests
tests/unit/ReceiptUploadRetryHandlerTest.ts(exists): on web,resolveReceiptFilereturns aFilefor a live blob URL andundefinedfor a dead one;
buildRetryPayloadnow proceeds on web for a local sourceand falls back cleanly when the file cannot be resolved.
the failure data AND the server-message error on the transaction; a
non-expense command does not; a 460 response injects nothing.
tests/unit/SequentialQueueTest.ts: a 426 response leaves the request inthe persisted queue and the queue paused, applies no failure data, and the
same request is sent after a simulated relaunch; a 200 response still
removes the request (regression control).
Alternatives considered
no server copy - the upload is what failed.
server's reason does not exist at enqueue time; no static text can
substitute for it.
would show an error for an app-version problem, and on web the receipt blob
would be gone after the forced update, making the expense unrecoverable -
the opposite of this issue's goal.
keep their current apply-failure-data-and-continue behaviour; only 426
means "this client must stop and upgrade".
melvin-bot commentedon Nov 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
dankezo commentedon Nov 16, 2026
Proposal updated: please review this version of my proposal above (#106966 (comment)), reformatted into the official template. The solution and scope are unchanged.
Contributor details
Your Expensify account email: dannyphan190@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013b564a690d9bcdab
Please re-state the problem that we are trying to solve in this issue.
A user whose receipt or expense request fails cannot always recover:
the server's actual reason.
silently discarded even though nothing about the expense itself failed.
What is the root cause of that problem?
Web retry is disabled by a blanket ban.
isRetrySupportedon web(
src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts) hardcodesfalse- "Web only has the receipt as a blob URL, which is gone after areload, so there is nothing to resend" - and the web
resolveReceiptFile.tsreturnsundefinedunconditionally. Both retrypayload builders bail on the flag (
buildRetryPayload.ts:27,buildReplaceReceiptRetryPayload.ts:46). The reasoning only covers theAFTER-RELOAD case. Within the same session the blob URL is still alive and
fetchable, so the recoverable case is banned along with the unrecoverable
one.
The server's message never reaches the user. In
applyHTTPSOnyxUpdates(src/libs/actions/OnyxUpdates.ts:94-111),response.messageis in scope at the exact pointrequest.failureDataisapplied -
trackExpenseApiErroralready records it for telemetry - but theuser only ever sees the generic error that was baked into the failure data
when the request was enqueued, before the server had said anything.
A 426 reads as success to the queue.
HttpUtils.ts:245-256RESOLVES(does not reject) on
CONST.JSON_CODE.UPDATE_REQUIRED(426) after callingalertUser(). SequentialQueue's.thenhandler then removes the requestunconditionally (lines 486-490, "Removing persisted request because it was
processed successfully"). The handler does know how to pause - it checks
response?.shouldPauseQueueat line 481 - but a 426 response never setsit, and removal happens regardless. The expense is deleted from the queue
for an app-version problem that has nothing to do with the expense.
What changes do you think we should make in order to solve the problem?
Web retry - implement
resolveReceiptFileand lift the ban.src/libs/ReceiptUploadRetryHandler/resolveReceiptFile.ts(web):implement the existing
ResolveReceiptFiletype -fetch(source),convert the blob to a
Filewith the stored filename, return it. If thefetch fails (the blob is gone, e.g. after a reload), return
undefined.src/libs/ReceiptUploadRetryHandler/isRetrySupported.ts(web): exporttrue. The builders already gate onisLocalFile(source)and alreadyhandle an unresolved file by falling back to asking the user to pick the
receipt again - so after a reload the flow degrades to "re-select the
receipt" instead of "no retry exists". Native files are untouched (the
native
isRetrySupportedis alreadytrueand the nativeresolveReceiptFilealready works).Surface the server's message. In
applyHTTPSOnyxUpdates, in thejsonCode !== 200 && request.failureDatabranch, when ALL of these hold:the command is an expense or receipt write command, the request carries a
transactionID, andresponse.messageis non-empty - append one extraupdate to the batch applied with the failure data: a MERGE on the
transaction key setting
errorsfrom the server message (microsecondOnyx error format, same as other transaction errors). The injection
respects the existing 460 ADMIN_REQUIRED skip: when failure data is not
applied, no message is injected either. Non-expense commands are
untouched, so no other flow's error surface changes.
A 426 pauses the queue and KEEPS the request.
HttpUtils.ts: on the non-prefetched UPDATE_REQUIRED path, in additionto
alertUser(), mark the resolved responseshouldPauseQueue = true-the flag SequentialQueue already honours.
SequentialQueue.ts.thenhandler: whenresponse?.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED, pause, andreturn WITHOUT removing the request, WITHOUT committing
queueFlushedData, and WITHOUT applying failure data. The expense isnot failed; it is deferred. After the user updates and the app relaunches,
the persisted request replays through the normal flush and the receipt
uploads with no user action.
Not changed: native retry behaviour, the update-required modal itself
(
alertUser), the OpenApp failure modal logic, the 460 handling, and thetelemetry in
trackExpenseApiError(it keeps recording the message; the usernow sees it too).
Tests:
tests/unit/ReceiptUploadRetryHandlerTest.ts(exists): on web,resolveReceiptFilereturns aFilefor a live blob URL andundefinedfor a dead one;
buildRetryPayloadnow proceeds on web for a local sourceand falls back cleanly when the file cannot be resolved.
the failure data AND the server-message error on the transaction; a
non-expense command does not; a 460 response injects nothing.
tests/unit/SequentialQueueTest.ts: a 426 response leaves the request inthe persisted queue and the queue paused, applies no failure data, and the
same request is sent after a simulated relaunch; a 200 response still
removes the request (regression control).
What alternative solutions did you explore? (Optional)
no server copy - the upload is what failed.
server's reason does not exist at enqueue time; no static text can
substitute for it.
would show an error for an app-version problem, and on web the receipt blob
would be gone after the forced update, making the expense unrecoverable -
the opposite of this issue's goal.
keep their current apply-failure-data-and-continue behaviour; only 426
means "this client must stop and upgrade".
melvin-bot commentedon Nov 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
expensify-chore-bot commentedon Nov 19, 2026
@adhorodyski Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
expensify-chore-bot commentedon Nov 23, 2026
@adhorodyski Still overdue 6 days?! Let's take care of this!
expensify-chore-bot commentedon Nov 25, 2026
@adhorodyski Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
expensify-chore-bot commentedon Nov 27, 2026
@adhorodyski 10 days overdue. Is anyone even seeing these? Hello?
expensify-chore-bot commentedon Nov 30, 2026
@Pujan92 @mountiny @adhorodyski this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!