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] "Report not found" screens and other receipt errors never reach Sentry #106965
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
changed the title [-]"Report not found" screens and other receipt errors never reach Sentry[/-][+][$175] "Report not found" screens and other receipt errors never reach Sentry[/+]on Nov 16, 2026
“Report not found” already logs, but Sentry rejects the message. Its message does not match the forwarding allowlist. Adding the message alone would still discard its diagnostic parameters unless those are explicitly allowed.
Image-loading timeouts update the UI without logging the timeout. Generic long-spinner warnings exist, so “placeholders never log” is too broad.
Several receipt-crop failure paths silently return or fall back to the original image. Other crop paths already warn, but those warnings are not explicitly forwarded to Sentry.
Confidence: medium overall. The code establishes these gaps, but production log access was unavailable. The reported 4,000–5,000 daily occurrences remain unverified. This analysis does not establish the cause of missing receipts or erased descriptions.
Code evidence and alternative explanations checked
What changes do you think we should make in order to solve the problem?
Allow the specific [ReportScreen] Displaying NotFound Page message family, covering both guards. Add narrowly scoped, privacy-reviewed diagnostic fields.
Log at the existing image-timeout transition, with component and timeout reason. Preserve offline behavior, retries and late-success recovery; do not introduce another timer.
Add fixed failure events for receipt-crop rejection, missing output and fallback paths. Distinguish manipulation failure from downstream save failure. Cover automatic cropping and web camera cropping separately; receipt-editor catches do not cover those paths.
Forward the new events with explicitly allowed metadata. Exclude receipt URLs, local paths, filenames, image data and unsanitized error messages.
Preserve expected invalid/deleted-report behavior. These should reach Sentry Logs and breadcrumbs, not automatically become error issues.
Regression coverage
Test both not-found messages and metadata filtering; timeout logging once per attempt, with no event after success/offline/unmount; retry and late-success behavior; crop rejection, missing output and successful-original fallback. Assert unchanged UI cleanup and no sensitive data in messages or attributes.
No runtime tests were executed.
What alternative solutions did you explore? (Optional)
Broadly forwarding all report/image warnings or changing every event to error severity would increase noise and risk exposing URL-bearing messages. Narrow event forwarding addresses the demonstrated gaps.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/106965) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
There are three specific logging/telemetry gaps causing receipt errors and "Report not found" screens to be lost:
[ReportScreen] Displaying NotFound Page is omitted from Sentry forwarder:
In src/pages/inbox/ReportNotFoundGuard.tsx:89, the app logs when the not-found page is triggered:
However, in src/libs/telemetry/forwardLogsToSentry.ts:35–44, FORWARDED_LOG_PREFIXES only contains: ['[MFA]', '[OnyxUpdateManagerError]', '[Receipt]', '[PDFStall]', '[OpenReportStall]', '[withNavigationFallback]', '[createDynamicRoute]', '[UpdateRequired]'].
Because '[ReportScreen]' is missing from FORWARDED_LOG_PREFIXES and its parameters are not listed in PREFIX_SCOPED_PARAMETERS_WHITELIST, the Sentry logger silently filters out all 4,000–5,000 daily occurrences before they can be forwarded.
Image loading timeout / placeholder stalls are unlogged:
When a receipt fails to load and the stall timer fires in src/hooks/useImageLoadStall.ts / src/components/ImageWithLoading.tsx (introduced in PR Fail a receipt image that never loads instead of spinning forever #102887), the callback sets error/fallback states to dismiss the spinner, but never invokes Log.alert or Log.info with a [Receipt] prefix to record the timeout.
Failed crops fail silently without error logging:
In src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:56–80, src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx:456–504, and CameraCapture.tsx:44–92, when cropping fails (e.g. ImageManipulator.manipulateAsync throws or yields an invalid result), the catch block silently swallows the failure or falls back to the original image without logging any telemetry event.
What changes do you think we should make in order to solve the problem?
Forward [ReportScreen] not-found events to Sentry:
In src/libs/telemetry/forwardLogsToSentry.ts:
Add '[ReportScreen]' to FORWARDED_LOG_PREFIXES.
Add an entry for '[ReportScreen]' to PREFIX_SCOPED_PARAMETERS_WHITELIST allowing safe diagnostic keys: ['reportID', 'reportIDFromPath', 'isLoadingApp', 'isLoadingReportData', 'isOffline', 'isLoadingInitialReportActions', 'isOptimisticDelete', 'userLeavingStatus', 'isPendingCreation', 'deleteTransactionNavigateBackUrl', 'isBillHidden'].
Log receipt loading placeholder stalls:
In src/hooks/useImageLoadStall.ts (or MoneyRequestReceiptView.tsx), when the image load stall timeout triggers:
Ensure 'loadingStalled' and 'timeoutMs' are allowed under '[Receipt]' in PREFIX_SCOPED_PARAMETERS_WHITELIST.
Log failed crop operations:
In src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts and TransactionReceiptModalContent.tsx:
In the catch blocks where cropping fails or falls back to the original uncropped asset, call Log.alert(${RECEIPT_LOG_PREFIX} cropFailed, { event: 'cropFailed', receiptTraceId, transactionID, error: error?.message, fallbackToOriginal: true }).
Allow 'cropFailed' and 'fallbackToOriginal' in PREFIX_SCOPED_PARAMETERS_WHITELIST.
What alternative solutions did you explore? (Optional)
We evaluated forwarding all general informational logs (Log.info) directly to Sentry. However, forwarding without prefix and parameter allowlists would flood Sentry with excessive log volume and potentially expose unredacted parameters. Scoping specifically to '[ReportScreen]' and instrumenting the missing failure branches under the existing '[Receipt]' umbrella maintains privacy and keeps error tracking clean.
Please re-state the problem that we are trying to solve in this issue.
When users hit a "Report not found" screen (ReportNotFoundGuard), the app logs [ReportScreen] Displaying NotFound Page, but those logs are never forwarded to Sentry (0 of the ~4,000–5,000 daily occurrences reach Sentry).
When cropping or rotating a receipt image fails (cropImageToAspectRatio.ts and TransactionReceiptModalContent.tsx), the .catch blocks silently swallow the error without logging.
What is the root cause of that problem?
[ReportScreen] is missing from FORWARDED_LOG_PREFIXES (src/libs/telemetry/forwardLogsToSentry.ts:242-251):
However, FORWARDED_LOG_PREFIXES in src/libs/telemetry/forwardLogsToSentry.ts does not include '[ReportScreen]', and PREFIX_SCOPED_PARAMETERS_WHITELIST does not whitelist its parameter keys, so getMatchedForwardPrefix returns undefined and drops every [ReportScreen] log.
Stalled image/receipt loading placeholders do not emit a forwarded log when useImageLoadStall times out:
In PR Fail a receipt image that never loads instead of spinning forever #102887 (src/hooks/useImageLoadStall.ts, src/components/ImageView/index.tsx:95-98, src/components/ImageWithLoading.tsx:75-78, and src/components/Lightbox/index.tsx:230-233), handleLoadTimeout sets updateLoadTimedOut(true) and setIsLoading(false), and ActivityIndicator logs [AppState] Will log app state on long loading..., neither of which emits a [Receipt] (or forwarded [ImageLoadStall]) log to Sentry.
Failed receipt crops and rotations swallow errors in .catch without logging:
In src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:80, the promise chain ends with .catch(() => image) without logging the failure.
In src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx, both rotateReceipt (line 434: .catch(() => { setIsRotating(false); })) and saveCrop (line 508: .catch(() => { setIsCropSaving(false); exitCropMode(); })) swallow errors from cropOrRotateImage / applyDurableReceipt without logging.
What changes do you think we should make in order to solve the problem?
Forward [ReportScreen] NotFound logs and their safe diagnostic parameters to Sentry (src/libs/telemetry/forwardLogsToSentry.ts & src/pages/inbox/ReportNotFoundGuard.tsx):
Use Log.warn (or keep Log.info and include '[ReportScreen]' in FORWARDED_LOG_PREFIXES) in ReportNotFoundGuard.tsx:95 and 181.
In src/libs/telemetry/forwardLogsToSentry.ts:
Add '[ReportScreen]' to FORWARDED_LOG_PREFIXES.
Add a ['[ReportScreen]', ['isLoadingApp', 'isLoadingReportData', 'isOffline', 'isLoadingInitialReportActions', 'reportID', 'isOptimisticDelete', 'userLeavingStatus', 'reportIDFromPath', 'isPendingCreation', 'deleteTransactionNavigateBackUrl', 'isBillHidden', 'isParentActionDeleted', 'isParentActionMissingAfterLoad']] entry to PREFIX_SCOPED_PARAMETERS_WHITELIST.
Log stalled image/receipt loading placeholders to Sentry (src/components/ImageView/index.tsx, src/components/ImageWithLoading.tsx, src/components/Lightbox/index.tsx, or src/hooks/useImageLoadStall.ts):
When useImageLoadStall triggers onStalled (or inside handleLoadTimeout in ImageView, ImageWithLoading, and Lightbox, / ReceiptImage placeholder timeouts), emit a forwarded warning log (e.g. Log.warn('[Receipt] Image load stalled', { event: 'image_load_stalled', context, hasActivity, hasPreview }) or under a dedicated '[ImageLoadStall]' prefix in FORWARDED_LOG_PREFIXES with ['context', 'hasActivity', 'hasPreview', 'attachmentID', 'isLocalFile'] whitelisted, never logging raw URLs/filenames).
Log failed receipt crops and rotations (src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts & src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx):
In src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:80:
.catch((error: unknown)=>{Log.warn('[Receipt] Failed to crop image to aspect ratio',{event: 'crop_failed',errorMessage: errorinstanceofError ? error.message : String(error),});returnimage;});
In src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx (rotateReceipt and saveCrop.catch blocks), log Log.warn('[Receipt] Failed to crop or rotate receipt', { event: 'crop_or_rotate_failed', transactionID: transaction.transactionID, errorMessage: error instanceof Error ? error.message : String(error) }) so all failed crops/rotations are forwarded under [Receipt] to Sentry.
Add unit tests (tests/unit/forwardLogsToSentryTest.ts, tests/unit/calculateCropRectTest.ts, tests/unit/hooks/useImageLoadStall.test.ts):
Verify [ReportScreen] logs and their whitelisted parameters are forwarded to Sentry.logger and Sentry.addBreadcrumb.
Verify stalled image loads and failed cropImageToAspectRatio calls emit forwarded Sentry logs without leaking raw file URIs or filenames.
What alternative solutions did you explore? (Optional)
Widening the global PARAMETERS_WHITELIST instead of using PREFIX_SCOPED_PARAMETERS_WHITELIST: Using PREFIX_SCOPED_PARAMETERS_WHITELIST for '[ReportScreen]' and '[Receipt]' follows the existing pattern in forwardLogsToSentry.ts so diagnostic keys are strictly scoped to their prefix and cannot leak from unrelated logs.
"Report not found" screens never reach Sentry, and several receipt errors
are never logged at all - so the team cannot see how often users hit a dead
end, or why receipt rotate/crop operations fail.
Root cause
Sentry forwarding is allowlist-based, and the report-screen logs are not on
the list:
forwardLogsToSentry only forwards a log line when its message contains
one of FORWARDED_LOG_PREFIXES (src/libs/telemetry/forwardLogsToSentry.ts:35-44): [MFA], [OnyxUpdateManagerError], [Receipt], [PDFStall], [OpenReportStall], [withNavigationFallback], [createDynamicRoute], [UpdateRequired]. [ReportScreen] is not among them.
ReportNotFoundGuard (src/pages/inbox/ReportNotFoundGuard.tsx) logs
both not-found cases with exactly that prefix - "Displaying NotFound Page"
(lines 89-100) and "Displaying NotFound Page (deleted transaction thread)"
(lines 175-179) - so both are dropped before Sentry ever sees them.
The log LEVEL is not the blocker, and it is worth stating why: mapLogMessageToSentryLevel (forwardLogsToSentry.ts:98-109) forwards every
level - [alrt] as error, [warn]/[hmmm] as warn, [info] as info,
anything else as debug. Once the prefix is allowlisted, the existing lines
forward as-is. Any fix that only changes levels, or only adds logging calls,
does nothing.
Separately, two receipt errors are never logged in the first place: in TransactionReceiptModalContent, the rotate flow's catch (lines 429-431)
and the crop-save flow's catch (lines 501-503) swallow the error with only a
state reset (setIsRotating(false) / setIsCropSaving(false)). No log line
exists for the prefix filter to forward.
Changes
Allowlist the prefix. Add '[ReportScreen]' to FORWARDED_LOG_PREFIXES in forwardLogsToSentry.ts.
Scope its parameters. Add a '[ReportScreen]' entry to PREFIX_SCOPED_PARAMETERS_WHITELIST for the parameters the two guard
logs actually carry (reportIDFromPath and the loading/offline flags),
mirroring the [PDFStall] / [OpenReportStall] entries that whitelist reportID. Nothing else about these lines is forwarded - the whitelist
discipline the file's own warning comment demands is preserved.
Raise the two guard logs to the right level. Change both ReportNotFoundGuard logs from Log.info to Log.warn. A report the
user navigated to cannot be shown - that is a user-facing dead end and
belongs at Sentry warn level, visible but not an error storm. NOT Log.alert: at thousands of not-found displays a day, error level would
flood Sentry and drown real errors - the same reason receipt
observability reserves alert for drops and give-ups.
Log the swallowed receipt errors. In TransactionReceiptModalContent,
the rotate and crop-save catches log the caught error with Log.warn
under the existing [Receipt] prefix (already allowlisted, with its
scoped parameter whitelist) before resetting the state flags. The user
experience is unchanged; the failure becomes visible.
Not changed: the not-found UI itself, the guard's conditions for showing
it, any other prefix or whitelist entry, and the forwarding of levels - mapLogMessageToSentryLevel already does the right thing.
Tests
tests/unit/forwardLogsToSentryTest.ts (exists): a [ReportScreen]
Log.warn line is forwarded at warn level with its whitelisted parameters,
a non-whitelisted parameter on the same line is stripped, and a [ReportScreen] line is no longer dropped.
ReportNotFoundGuard rendering is unchanged (the guard still shows the
not-found page under the same conditions) - covered by its existing tests.
The rotate/crop catches still reset their state flags when the underlying
call rejects, now with the warn log emitted.
Alternatives considered
Use Log.alert for the not-found logs (as in one existing proposal).
Rejected: alert maps to Sentry error level. These events are frequent and
usually not actionable one by one; warn preserves the signal (counts,
parameters, trends) without flooding the error stream.
Change mapLogMessageToSentryLevel or forward all prefixes.
Rejected: the level mapping already forwards everything, and the prefix
allowlist is a deliberate privacy control (the file warns there is no
redaction yet). The fix works within that control instead of weakening it.
Add new log calls in the guard instead of allowlisting the prefix.
Rejected: the log calls already exist with the right parameters; the
filter is what drops them.
@adhorodyski I looked into this one. Two of the three parts are already in open PRs: #107120 logs the not-found screen in both guards, and #107399 logs the image stalls from useImageLoadStall. If MelvinBot's proposal goes in as written, each not-found screen and each stall would reach Sentry twice, and the PRs would conflict.
Nothing covers the failed crops yet. I found four places where a crop fails without a log: rotate and crop in the receipt editor, the iOS fallback in cropOrRotateImage (it saves the uncropped image and only logs an unprefixed warn), cropImageToAspectRatio for odometer photos, and the web camera, where the shutter blinks but no photo is taken. I checked each one in the code, and confirmed the iOS warn and cropImageToAspectRatio cases with a quick test on main.
I think this issue should only cover the crops. I can log them with [Receipt] keys that are already allowed, so it won't conflict with either PR. Should I post a proposal?
@mountiny@adhorodyski@nyomanjyotisa 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!
I checked the problems from the description. Some of the PRs on this topic were already merged (mostly in #107399 and #107120). So part of it is covered and logs are already showing up in Sentry at least on staging.
Report not found screens never reach Sentry #108707 sends the "not found" page you get when opening an expense report from Search to Sentry. It's straightforward to test - open a Search link to a report that doesn't exist and check the line in Sentry
Receipt crop never reach Sentry #108784 logs receipt crops that fail without telling anyone. This one would be trickier to test, because the failures have to be forced with a small local patch. The steps are in the PR
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
Activity
expensify-chore-bot commentedon Nov 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @nyomanjyotisa (
External)[-]"Report not found" screens and other receipt errors never reach Sentry[/-][+][$175] "Report not found" screens and other receipt errors never reach Sentry[/+]expensify-chore-bot commentedon Nov 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022122192586369889064
MelvinBot commentedon Nov 16, 2026
Proposal
What is the root cause of that problem?
Three separate telemetry gaps exist in App:
Confidence: medium overall. The code establishes these gaps, but production log access was unavailable. The reported 4,000–5,000 daily occurrences remain unverified. This analysis does not establish the cause of missing receipts or erased descriptions.
Code evidence and alternative explanations checked
What changes do you think we should make in order to solve the problem?
[ReportScreen] Displaying NotFound Pagemessage family, covering both guards. Add narrowly scoped, privacy-reviewed diagnostic fields.Regression coverage
Test both not-found messages and metadata filtering; timeout logging once per attempt, with no event after success/offline/unmount; retry and late-success behavior; crop rejection, missing output and successful-original fallback. Assert unchanged UI cleanup and no sensitive data in messages or attributes.
No runtime tests were executed.
What alternative solutions did you explore? (Optional)
Broadly forwarding all report/image warnings or changing every event to error severity would increase noise and risk exposing URL-bearing messages. Narrow event forwarding addresses the demonstrated gaps.
Related issue: Error and loading states should log what happened and match what the user did overlaps with the broader state-logging work; coordinate coverage to avoid duplicate instrumentation.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/106965)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 logging/telemetry gaps causing receipt errors and "Report not found" screens to be lost:
[ReportScreen] Displaying NotFound Pageis omitted from Sentry forwarder:In
src/pages/inbox/ReportNotFoundGuard.tsx:89, the app logs when the not-found page is triggered:However, in
src/libs/telemetry/forwardLogsToSentry.ts:35–44,FORWARDED_LOG_PREFIXESonly contains:['[MFA]', '[OnyxUpdateManagerError]', '[Receipt]', '[PDFStall]', '[OpenReportStall]', '[withNavigationFallback]', '[createDynamicRoute]', '[UpdateRequired]'].Because
'[ReportScreen]'is missing fromFORWARDED_LOG_PREFIXESand its parameters are not listed inPREFIX_SCOPED_PARAMETERS_WHITELIST, the Sentry logger silently filters out all 4,000–5,000 daily occurrences before they can be forwarded.Image loading timeout / placeholder stalls are unlogged:
When a receipt fails to load and the stall timer fires in
src/hooks/useImageLoadStall.ts/src/components/ImageWithLoading.tsx(introduced in PR Fail a receipt image that never loads instead of spinning forever #102887), the callback sets error/fallback states to dismiss the spinner, but never invokesLog.alertorLog.infowith a[Receipt]prefix to record the timeout.Failed crops fail silently without error logging:
In
src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:56–80,src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx:456–504, andCameraCapture.tsx:44–92, when cropping fails (e.g.ImageManipulator.manipulateAsyncthrows or yields an invalid result), the catch block silently swallows the failure or falls back to the original image without logging any telemetry event.What changes do you think we should make in order to solve the problem?
[ReportScreen]not-found events to Sentry:src/libs/telemetry/forwardLogsToSentry.ts:'[ReportScreen]'toFORWARDED_LOG_PREFIXES.'[ReportScreen]'toPREFIX_SCOPED_PARAMETERS_WHITELISTallowing safe diagnostic keys:['reportID', 'reportIDFromPath', 'isLoadingApp', 'isLoadingReportData', 'isOffline', 'isLoadingInitialReportActions', 'isOptimisticDelete', 'userLeavingStatus', 'isPendingCreation', 'deleteTransactionNavigateBackUrl', 'isBillHidden'].src/hooks/useImageLoadStall.ts(orMoneyRequestReceiptView.tsx), when the image load stall timeout triggers:Log.alert(${RECEIPT_LOG_PREFIX} loadingStalled, { event: 'loadingStalled', receiptTraceId, transactionID, timeoutMs, isOffline: String(getIsOffline()) }).'loadingStalled'and'timeoutMs'are allowed under'[Receipt]'inPREFIX_SCOPED_PARAMETERS_WHITELIST.src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.tsandTransactionReceiptModalContent.tsx:Log.alert(${RECEIPT_LOG_PREFIX} cropFailed, { event: 'cropFailed', receiptTraceId, transactionID, error: error?.message, fallbackToOriginal: true }).'cropFailed'and'fallbackToOriginal'inPREFIX_SCOPED_PARAMETERS_WHITELIST.What alternative solutions did you explore? (Optional)
Log.info) directly to Sentry. However, forwarding without prefix and parameter allowlists would flood Sentry with excessive log volume and potentially expose unredacted parameters. Scoping specifically to'[ReportScreen]'and instrumenting the missing failure branches under the existing'[Receipt]'umbrella maintains privacy and keeps error tracking clean.Contributor Details:
cocvn157 commentedon Nov 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
ReportNotFoundGuard), the app logs[ReportScreen] Displaying NotFound Page, but those logs are never forwarded to Sentry (0of the ~4,000–5,000 daily occurrences reach Sentry).useImageLoadStallinImageView,ImageWithLoading, andLightboxadded in Fail a receipt image that never loads instead of spinning forever #102887, or long-runningActivityIndicator), the stall/timeout is not logged to Sentry.cropImageToAspectRatio.tsandTransactionReceiptModalContent.tsx), the.catchblocks silently swallow the error without logging.What is the root cause of that problem?
[ReportScreen]is missing fromFORWARDED_LOG_PREFIXES(src/libs/telemetry/forwardLogsToSentry.ts:242-251):src/pages/inbox/ReportNotFoundGuard.tsxlogs:Log.info('[ReportScreen] Displaying NotFound Page', false, { isLoadingApp, isLoadingReportData, isOffline, isLoadingInitialReportActions, reportID, isOptimisticDelete, userLeavingStatus, reportIDFromPath: routeParams?.reportID, isPendingCreation, deleteTransactionNavigateBackUrl, isBillHidden });Log.info('[ReportScreen] Displaying NotFound Page (deleted transaction thread)', false, { reportIDFromPath, isParentActionDeleted, isParentActionMissingAfterLoad });FORWARDED_LOG_PREFIXESinsrc/libs/telemetry/forwardLogsToSentry.tsdoes not include'[ReportScreen]', andPREFIX_SCOPED_PARAMETERS_WHITELISTdoes not whitelist its parameter keys, sogetMatchedForwardPrefixreturnsundefinedand drops every[ReportScreen]log.Stalled image/receipt loading placeholders do not emit a forwarded log when
useImageLoadStalltimes out:src/hooks/useImageLoadStall.ts,src/components/ImageView/index.tsx:95-98,src/components/ImageWithLoading.tsx:75-78, andsrc/components/Lightbox/index.tsx:230-233),handleLoadTimeoutsetsupdateLoadTimedOut(true)andsetIsLoading(false), andActivityIndicatorlogs[AppState] Will log app state on long loading..., neither of which emits a[Receipt](or forwarded[ImageLoadStall]) log to Sentry.Failed receipt crops and rotations swallow errors in
.catchwithout logging:src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:80, the promise chain ends with.catch(() => image)without logging the failure.src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx, bothrotateReceipt(line 434:.catch(() => { setIsRotating(false); })) andsaveCrop(line 508:.catch(() => { setIsCropSaving(false); exitCropMode(); })) swallow errors fromcropOrRotateImage/applyDurableReceiptwithout logging.What changes do you think we should make in order to solve the problem?
Forward
[ReportScreen]NotFound logs and their safe diagnostic parameters to Sentry (src/libs/telemetry/forwardLogsToSentry.ts&src/pages/inbox/ReportNotFoundGuard.tsx):Log.warn(or keepLog.infoand include'[ReportScreen]'inFORWARDED_LOG_PREFIXES) inReportNotFoundGuard.tsx:95and181.src/libs/telemetry/forwardLogsToSentry.ts:'[ReportScreen]'toFORWARDED_LOG_PREFIXES.['[ReportScreen]', ['isLoadingApp', 'isLoadingReportData', 'isOffline', 'isLoadingInitialReportActions', 'reportID', 'isOptimisticDelete', 'userLeavingStatus', 'reportIDFromPath', 'isPendingCreation', 'deleteTransactionNavigateBackUrl', 'isBillHidden', 'isParentActionDeleted', 'isParentActionMissingAfterLoad']]entry toPREFIX_SCOPED_PARAMETERS_WHITELIST.Log stalled image/receipt loading placeholders to Sentry (
src/components/ImageView/index.tsx,src/components/ImageWithLoading.tsx,src/components/Lightbox/index.tsx, orsrc/hooks/useImageLoadStall.ts):useImageLoadStalltriggersonStalled(or insidehandleLoadTimeoutinImageView,ImageWithLoading, andLightbox, /ReceiptImageplaceholder timeouts), emit a forwarded warning log (e.g.Log.warn('[Receipt] Image load stalled', { event: 'image_load_stalled', context, hasActivity, hasPreview })or under a dedicated'[ImageLoadStall]'prefix inFORWARDED_LOG_PREFIXESwith['context', 'hasActivity', 'hasPreview', 'attachmentID', 'isLocalFile']whitelisted, never logging raw URLs/filenames).Log failed receipt crops and rotations (
src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts&src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx):src/pages/iou/request/step/IOURequestStepScan/cropImageToAspectRatio.ts:80:src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx(rotateReceiptandsaveCrop.catchblocks), logLog.warn('[Receipt] Failed to crop or rotate receipt', { event: 'crop_or_rotate_failed', transactionID: transaction.transactionID, errorMessage: error instanceof Error ? error.message : String(error) })so all failed crops/rotations are forwarded under[Receipt]to Sentry.Add unit tests (
tests/unit/forwardLogsToSentryTest.ts,tests/unit/calculateCropRectTest.ts,tests/unit/hooks/useImageLoadStall.test.ts):[ReportScreen]logs and their whitelisted parameters are forwarded toSentry.loggerandSentry.addBreadcrumb.cropImageToAspectRatiocalls emit forwarded Sentry logs without leaking raw file URIs or filenames.What alternative solutions did you explore? (Optional)
PARAMETERS_WHITELISTinstead of usingPREFIX_SCOPED_PARAMETERS_WHITELIST: UsingPREFIX_SCOPED_PARAMETERS_WHITELISTfor'[ReportScreen]'and'[Receipt]'follows the existing pattern inforwardLogsToSentry.tsso diagnostic keys are strictly scoped to their prefix and cannot leak from unrelated logs.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
"Report not found" screens never reach Sentry, and several receipt errors
are never logged at all - so the team cannot see how often users hit a dead
end, or why receipt rotate/crop operations fail.
Root cause
Sentry forwarding is allowlist-based, and the report-screen logs are not on
the list:
forwardLogsToSentryonly forwards a log line when its message containsone of
FORWARDED_LOG_PREFIXES(src/libs/telemetry/forwardLogsToSentry.ts:35-44):[MFA],[OnyxUpdateManagerError],[Receipt],[PDFStall],[OpenReportStall],[withNavigationFallback],[createDynamicRoute],[UpdateRequired].[ReportScreen]is not among them.ReportNotFoundGuard(src/pages/inbox/ReportNotFoundGuard.tsx) logsboth not-found cases with exactly that prefix - "Displaying NotFound Page"
(lines 89-100) and "Displaying NotFound Page (deleted transaction thread)"
(lines 175-179) - so both are dropped before Sentry ever sees them.
The log LEVEL is not the blocker, and it is worth stating why:
mapLogMessageToSentryLevel(forwardLogsToSentry.ts:98-109) forwards everylevel -
[alrt]as error,[warn]/[hmmm]as warn,[info]as info,anything else as debug. Once the prefix is allowlisted, the existing lines
forward as-is. Any fix that only changes levels, or only adds logging calls,
does nothing.
Separately, two receipt errors are never logged in the first place: in
TransactionReceiptModalContent, the rotate flow's catch (lines 429-431)and the crop-save flow's catch (lines 501-503) swallow the error with only a
state reset (
setIsRotating(false)/setIsCropSaving(false)). No log lineexists for the prefix filter to forward.
Changes
Allowlist the prefix. Add
'[ReportScreen]'toFORWARDED_LOG_PREFIXESinforwardLogsToSentry.ts.Scope its parameters. Add a
'[ReportScreen]'entry toPREFIX_SCOPED_PARAMETERS_WHITELISTfor the parameters the two guardlogs actually carry (
reportIDFromPathand the loading/offline flags),mirroring the
[PDFStall]/[OpenReportStall]entries that whitelistreportID. Nothing else about these lines is forwarded - the whitelistdiscipline the file's own warning comment demands is preserved.
Raise the two guard logs to the right level. Change both
ReportNotFoundGuardlogs fromLog.infotoLog.warn. A report theuser navigated to cannot be shown - that is a user-facing dead end and
belongs at Sentry warn level, visible but not an error storm. NOT
Log.alert: at thousands of not-found displays a day, error level wouldflood Sentry and drown real errors - the same reason receipt
observability reserves alert for drops and give-ups.
Log the swallowed receipt errors. In
TransactionReceiptModalContent,the rotate and crop-save catches log the caught error with
Log.warnunder the existing
[Receipt]prefix (already allowlisted, with itsscoped parameter whitelist) before resetting the state flags. The user
experience is unchanged; the failure becomes visible.
Not changed: the not-found UI itself, the guard's conditions for showing
it, any other prefix or whitelist entry, and the forwarding of levels -
mapLogMessageToSentryLevelalready does the right thing.Tests
tests/unit/forwardLogsToSentryTest.ts(exists): a[ReportScreen]Log.warn line is forwarded at warn level with its whitelisted parameters,
a non-whitelisted parameter on the same line is stripped, and a
[ReportScreen]line is no longer dropped.ReportNotFoundGuardrendering is unchanged (the guard still shows thenot-found page under the same conditions) - covered by its existing tests.
call rejects, now with the warn log emitted.
Alternatives considered
Log.alertfor the not-found logs (as in one existing proposal).Rejected: alert maps to Sentry error level. These events are frequent and
usually not actionable one by one; warn preserves the signal (counts,
parameters, trends) without flooding the error stream.
mapLogMessageToSentryLevelor forward all prefixes.Rejected: the level mapping already forwards everything, and the prefix
allowlist is a deliberate privacy control (the file warns there is no
redaction yet). The fix works within that control instead of weakening it.
Rejected: the log calls already exist with the right parameters; the
filter is what drops them.
melvin-bot commentedon Nov 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
7 remaining items
oqildev commentedon Nov 23, 2026
@adhorodyski I looked into this one. Two of the three parts are already in open PRs: #107120 logs the not-found screen in both guards, and #107399 logs the image stalls from
useImageLoadStall. If MelvinBot's proposal goes in as written, each not-found screen and each stall would reach Sentry twice, and the PRs would conflict.Nothing covers the failed crops yet. I found four places where a crop fails without a log: rotate and crop in the receipt editor, the iOS fallback in
cropOrRotateImage(it saves the uncropped image and only logs an unprefixed warn),cropImageToAspectRatiofor odometer photos, and the web camera, where the shutter blinks but no photo is taken. I checked each one in the code, and confirmed the iOS warn andcropImageToAspectRatiocases with a quick test on main.I think this issue should only cover the crops. I can log them with
[Receipt]keys that are already allowed, so it won't conflict with either PR. Should I post a proposal?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 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
expensify-chore-bot commentedon Nov 27, 2026
@adhorodyski 10 days overdue. I'm getting more depressed than Marvin.
mountiny commentedon Nov 28, 2026
@rinej is this something you could look into?
rinej commentedon Nov 30, 2026
yes, I will wrap up my current work and jump into it
expensify-chore-bot commentedon Nov 30, 2026
@mountiny @adhorodyski @nyomanjyotisa 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!
rinej commentedon Dec 1, 2026
I checked the problems from the description. Some of the PRs on this topic were already merged (mostly in #107399 and #107120). So part of it is covered and logs are already showing up in Sentry at least on staging.
What is left:
I am working on the PR for them
rinej commentedon Dec 3, 2026
I split this into two PRs:
Report not found screens never reach Sentry #108707 sends the "not found" page you get when opening an expense report from Search to Sentry. It's straightforward to test - open a Search link to a report that doesn't exist and check the line in Sentry
Receipt crop never reach Sentry #108784 logs receipt crops that fail without telling anyone. This one would be trickier to test, because the failures have to be forced with a small local patch. The steps are in the PR
Please have a look!
mountiny commentedon Dec 3, 2026
@rinej thank! There are some codex comments to address on one of them
rinej commentedon Dec 4, 2026
done, addressed on the comments