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
Receipt PDF download hangs indefinitely and expense report fails to load after approval #97273
Version Number: Reproducible in staging?: Needs reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@Kel-Expensify Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Open an expense report in New Expensify.
Update the expense report name.
Approve the expense report.
Attempt to Download PDF for the receipt.
Observe the behavior.
Close and reopen New Expensify.
Search for the approved expense report using the submitter's name.
Open the report and observe the loading behavior.
Expected Result:
The receipt PDF should download successfully.
After reopening the application, the expense report should load normally when searched.
Actual Result:
Downloading the receipt PDF remains stuck on an indefinite loading spinner.
After reopening the app, opening the expense report also results in an indefinite loading spinner, preventing the report from loading.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Root Cause (medium confidence — both symptoms are backend/runtime-driven, so they need production logs to confirm):
The two symptoms are separate mechanisms, but both are "the App is waiting on a server-pushed Onyx update that never arrives," which is exactly why this is Unable to reproduce — it depends on runtime queue/sync state, not a deterministic code path.
1. Download PDF spinner spins forever. The App-side flow is self-consistent and cannot itself stall other than by never receiving the backend update. exportReportToPDF optimistically SETs nvp_expensify_report_PDFFilename_{reportID} to null (spinner on) and there is no successData — the filename must arrive via a backend-pushed Onyx update. The modal only stops spinning when that key becomes a real filename (success) or 'error' (failure). If the server generates/queues the PDF but never pushes the filename update (and no failure fires), the spinner hangs indefinitely with no client-side timeout.
2. Report stuck loading after reopen. The report-open skeleton is driven by isLoadingInitialReportActions, stored in a RAM-only Onyx key (reportLoadingState_) that resets to true on every app restart. It is cleared only by OpenReport's success/failure data. The most plausible stuck path: after an approval (which pushes new report actions), the client falls behind on Onyx update IDs, so SaveResponseInOnyxdefers applying OpenReport's response and pauses the queue pending reconciliation. If that reconciliation never completes, the flag stays true forever → permanent skeleton (and ReportNotFoundGuard keeps isLoading true, so you get a spinner rather than a "not found" page). A secondary path: for a money report with total !== 0, shouldWaitForTransactions stays true until transactions load, so missing/unsynced transaction data also holds the skeleton up.
Recommended next steps: The actual fix for both symptoms is outside the App repo (server-side PDF generation for #1; the Onyx-update sync/reconciliation for #2), so this should be escalated to an internal engineer for backend/log investigation rather than fixed in App. Production logs for the affected reportID would confirm which path fires — see the queries below.
Action: Report/index.ts:6327-6356 — optimistic SET to null, failure MERGE 'error', no successData. downloadReportPDF only fetches an already-generated file; it does not generate the PDF.
Spinner logic: ReportPDFDownloadModal.tsx:56-121 — hasFinishedPDFDownload is true only when the filename key is set and not 'error'; otherwise ActivityIndicator renders. No timeout.
Note the approval/submit-via-PDF flow reuses the same NVP key (ReportWorkflow.ts:1678-1692) — worth checking whether the just-completed approval left that key in a state that interferes with the subsequent Download PDF.
Deferred-update path (most plausible): SaveResponseInOnyx.ts:42-53 pauses the queue on an update-ID gap; if reconciliation never completes, the flag never clears.
The report-name edit (Report/index.ts:3655-3704) writes only reportName/pendingFields and has no conflict resolver, so it cannot cancel OpenReport — it appears to be coincidental context in the repro steps rather than a direct cause.
Alternative explanations considered: (a) transaction data never syncing while total !== 0 (holds skeleton independent of the request); (b) fetchReport early-returning so no OpenReport ever runs to clear the RAM default. Logs disambiguate these from the update-gap path.
Logs that would confirm (for the affected reportID/account):
ExportReportToPDF for the report — did it succeed but return no onyxData for nvp_expensify_report_PDFFilename_{reportID}, or error/timeout without a failure jsonCode?
OpenReport for the report — response jsonCode, and any [OnyxUpdateManager] gap / GetMissingOnyxMessages / shouldPauseQueue activity around it.
[SequentialQueue] conflict-resolution or "Request failed too many times" entries for OpenReport.
Whether the report has total !== 0 but zero synced transactions server-side.
Next Steps for Contributor+ team:
This looks like a backend/sync root cause (server-side PDF generation and Onyx update reconciliation), so it needs an internal engineer with log access to confirm before any code change — a client-side "implement this" fix isn't appropriate here. To refine:@MelvinBot <your feedback>
Activity
exfy-zapier commentedon Jul 28, 2026
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
MelvinBot commentedon Jul 28, 2026
Issue Analysis
Root Cause (medium confidence — both symptoms are backend/runtime-driven, so they need production logs to confirm):
The two symptoms are separate mechanisms, but both are "the App is waiting on a server-pushed Onyx update that never arrives," which is exactly why this is Unable to reproduce — it depends on runtime queue/sync state, not a deterministic code path.
1. Download PDF spinner spins forever. The App-side flow is self-consistent and cannot itself stall other than by never receiving the backend update.
exportReportToPDFoptimistically SETsnvp_expensify_report_PDFFilename_{reportID}tonull(spinner on) and there is nosuccessData— the filename must arrive via a backend-pushed Onyx update. The modal only stops spinning when that key becomes a real filename (success) or'error'(failure). If the server generates/queues the PDF but never pushes the filename update (and no failure fires), the spinner hangs indefinitely with no client-side timeout.2. Report stuck loading after reopen. The report-open skeleton is driven by
isLoadingInitialReportActions, stored in a RAM-only Onyx key (reportLoadingState_) that resets totrueon every app restart. It is cleared only byOpenReport's success/failure data. The most plausible stuck path: after an approval (which pushes new report actions), the client falls behind on Onyx update IDs, soSaveResponseInOnyxdefers applyingOpenReport's response and pauses the queue pending reconciliation. If that reconciliation never completes, the flag staystrueforever → permanent skeleton (andReportNotFoundGuardkeepsisLoadingtrue, so you get a spinner rather than a "not found" page). A secondary path: for a money report withtotal !== 0,shouldWaitForTransactionsstays true until transactions load, so missing/unsynced transaction data also holds the skeleton up.Recommended next steps: The actual fix for both symptoms is outside the App repo (server-side PDF generation for #1; the Onyx-update sync/reconciliation for #2), so this should be escalated to an internal engineer for backend/log investigation rather than fixed in App. Production logs for the affected reportID would confirm which path fires — see the queries below.
Investigation details & evidence
Commit:
49c0d8e056372dda5cbabcfd413c0306c17d726bDownload PDF (symptom 1):
useExportActions.ts:250-266→ opens modal + firesexportReportToPDF.Report/index.ts:6327-6356— optimistic SET tonull, failure MERGE'error', no successData.downloadReportPDFonly fetches an already-generated file; it does not generate the PDF.ReportPDFDownloadModal.tsx:56-121—hasFinishedPDFDownloadis true only when the filename key is set and not'error'; otherwiseActivityIndicatorrenders. No timeout.ReportWorkflow.ts:1678-1692) — worth checking whether the just-completed approval left that key in a state that interferes with the subsequent Download PDF.Report load (symptom 2):
MoneyRequestReportView.tsx:156-215.shouldWaitForTransactions:MoneyRequestReportUtils.ts:145-164— stays true whentotal !== 0and no transactions loaded.RAM_ONLY_REPORT_LOADING_STATEatONYXKEYS.ts:876, default{isLoadingInitialReportActions: true}→ resets on restart.OpenReportsuccess/failure:Report/index.ts:1584-1654.SaveResponseInOnyx.ts:42-53pauses the queue on an update-ID gap; if reconciliation never completes, the flag never clears.ReportNotFoundGuard.tsx:45-73.Report/index.ts:3655-3704) writes onlyreportName/pendingFieldsand has no conflict resolver, so it cannot cancelOpenReport— it appears to be coincidental context in the repro steps rather than a direct cause.Alternative explanations considered: (a) transaction data never syncing while
total !== 0(holds skeleton independent of the request); (b)fetchReportearly-returning so noOpenReportever runs to clear the RAM default. Logs disambiguate these from the update-gap path.Logs that would confirm (for the affected reportID/account):
ExportReportToPDFfor the report — did it succeed but return no onyxData fornvp_expensify_report_PDFFilename_{reportID}, or error/timeout without a failure jsonCode?OpenReportfor the report — response jsonCode, and any[OnyxUpdateManager]gap /GetMissingOnyxMessages/shouldPauseQueueactivity around it.[SequentialQueue]conflict-resolution or "Request failed too many times" entries forOpenReport.total !== 0but zero synced transactions server-side.Next Steps for Contributor+ team:
This looks like a backend/sync root cause (server-side PDF generation and Onyx update reconciliation), so it needs an internal engineer with log access to confirm before any code change — a client-side "implement this" fix isn't appropriate here.
To refine:
@MelvinBot <your feedback>melvin-bot commentedon Jul 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)melvin-bot commentedon Jul 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022082203304791124964
mananjadhav commentedon Jul 29, 2026
I'll try to reproduce the issue.
mukhrr commentedon Jul 29, 2026
@mananjadhav I can
97273-before.mp4
mananjadhav commentedon Jul 29, 2026
@mukhrr Are you keen on posting a proposal for the same?
mukhrr commentedon Jul 29, 2026
@mananjadhav sure!
mukhrr commentedon Jul 29, 2026
But not sure I will be the first or not after Help Wanted, haha
14 remaining items
mjasikowski commentedon Aug 12, 2026
#98279 is on the way adding more logs
mjasikowski commentedon Aug 17, 2026
Logging PR in staging
melvin-bot commentedon Aug 20, 2026
@mjasikowski Whoops! This issue is 2 days overdue. Let's get this updated quick!
mananjadhav commentedon Aug 21, 2026
@mjasikowski Is this going to need any C+ review?
mjasikowski commentedon Aug 21, 2026
@mananjadhav not at the moment, thanks! I'll unassign you
mjasikowski commentedon Aug 24, 2026
Should be fixed by https://github.com/Expensify/Web-Expensify/pull/55437