Skip to content

[Due for payment 2026-11-25] [$175] [Sentry: APP-P65] TypeError: Cannot read property 'reportID' of undefined in DynamicReportDetailsPage #106883

Open

Description

@melvin-bot

Sentry

https://expensify.sentry.io/issues/APP-P65

Impact

  • 1 user, 1 event as of investigation.
  • First seen: 2026-11-13 06:21 UTC.
  • Platform: iOS HybridApp.
  • Release: 9.5.35.
  • Unhandled fatal TypeError during rendering.
  • Component: DynamicReportDetailsPage; recorded native view: Settings_Profile.

Top first-party frame

DynamicReportDetailsPage (index.tsx)

Followed by React Native Fabric render frames: renderWithHooks → beginWork → renderRootSync. Sentry’s source-line mapping appears inaccurate.

Likely root cause

The affected release’s component reads route.params.reportID without checking whether route.params exists. Missing navigation parameters cause the reported TypeError before ReportOrNotFoundGuard renders.

The exact navigation sequence producing missing parameters is not yet confirmed. An unloaded report alone does not explain this failure.

Suggested fix

  • Safely read the optional route parameters and handle a missing :reportID without throwing.
  • Investigate navigation/restoration paths that can mount this screen without its required parameters.
  • Add regression coverage for undefined route parameters and normal report loading.

Duplicate check

No matching tracker found in Expensify/App or Expensify/Expensify. Historical exact-error matches concern unrelated task-assignment and CSV-export bugs.

Investigation

https://expensify.slack.com/archives/C027V2LD9D1/p1794585240722679

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @nyomanjyotisa

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 13, 2026
  2. added theissue type on Nov 13, 2026
  3. melvin-bot commented on Nov 13, 2026

    @melvin-bot
    Author

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @nyomanjyotisa (External)

  4. changed the title [-][Sentry: APP-P65] TypeError: Cannot read property 'reportID' of undefined in DynamicReportDetailsPage[/-] [+][$175] [Sentry: APP-P65] TypeError: Cannot read property 'reportID' of undefined in DynamicReportDetailsPage[/+] on Nov 13, 2026
  5. melvin-bot commented on Nov 13, 2026

    @melvin-bot
    Author
  6. kevinjosh10 commented on Nov 13, 2026

    @kevinjosh10

    Proposal

    What is the root cause of that problem?

    In src/pages/DynamicReportDetailsPage/index.tsx:14-22:

    function DynamicReportDetailsPage({route}: DynamicReportDetailsPageProps) {
        const reportID = route.params.reportID;
    
        return (
            <ReportOrNotFoundGuard reportID={reportID}>
                <ReportDetailsContent reportID={reportID} />
            </ReportOrNotFoundGuard>
        );
    }
    1. route.params.reportID unconditionally dereferences route.params. When route.params is undefined (or omitted by React Navigation during restoration or empty navigations), JavaScript throws a fatal TypeError before ReportOrNotFoundGuard can mount.
    2. ReportOrNotFoundGuard is specifically designed to safely accept an optional/undefined reportID (reportID: string | undefined;). When reportID is undefined, isReportIdInRoute evaluates to false (!!reportID?.length), and getReportOrNotFoundDecision gracefully falls back to 'notFound' rendering <NotFoundPage isReportRelatedPage /> without crashing. However, because route.params.reportID throws beforehand, the guard never gets the chance to execute.
    3. Similarly, in src/pages/inbox/report/DynamicReportDetailsExportPage.tsx:38-40, connectionName is read defensively with route?.params?.connectionName, but reportID is read as route.params.reportID. And in src/pages/inbox/report/withReportOrNotFound.tsx:78-83, const params = props.route.params; does not check if params exists before checking 'notificationReportID' in params.

    What changes do you think we should make in order to solve the problem?

    1. Safely read reportID in DynamicReportDetailsPage/index.tsx:

      • In src/pages/DynamicReportDetailsPage/index.tsx:14-22, use optional chaining:
        const reportID = route?.params?.reportID;
      • Pass reportID ?? '' to <ReportDetailsContent reportID={reportID ?? ''} />. When reportID is undefined or empty, ReportOrNotFoundGuard handles it gracefully and renders <NotFoundPage isReportRelatedPage /> without mounting ReportDetailsContent.
    2. Defensively guard sibling screens and HOC:

    3. Add regression tests:

      • In tests/ui/DynamicReportDetailsPageTest.tsx:
        • Add a unit test verifying that DynamicReportDetailsPage renders <NotFoundPage /> without crashing when mounted with route={{params: undefined} as any} or {}.

    What alternative solutions did you explore? (Optional)

    • Throwing an error boundary / redirecting to Home on mount when route.params is absent: Rejected because ReportOrNotFoundGuard already provides the standardized, established pattern across the entire application for handling missing report IDs via NotFoundPage. Defensively reading route?.params?.reportID allows the guard to perform its intended job seamlessly.

    Contributor details

    Your Expensify account email: lkevinjosh10@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

  7. melvin-bot commented on Nov 13, 2026

    @melvin-bot
    Author

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  8. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 13, 2026
  9. MelvinBot commented on Nov 13, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    Medium confidence: the affected release reads route.params.reportID before rendering its not-found guard. If route.params is undefined, this produces the reported TypeError.

    There is a concrete source-level path to that state: /search/details is accepted by the dynamic routing configuration, but without report context or query parameters its generated details route omits params. This is a candidate trigger, not a confirmed reproduction of the reported iOS event.

    Code evidence and alternatives checked

    What changes do you think we should make in order to solve the problem?

    1. Safely extract the ID with route.params?.reportID, retaining the existing guard. Pass reportID ?? '' only to the string-typed content prop.
    2. Add regression coverage that mounts the actual page with undefined parameters, empty parameters, and a valid report ID.
    3. Test missing-ID behavior with global report loading unset, active, and finished, plus normal report loading.

    Correction to the existing proposal: missing parameters do not necessarily produce an immediate not-found page. The guard can show a loading indicator until global report loading finishes. Optional chaining prevents the crash but does not change that behavior.

    Scope and validation limits

    ReportOrNotFoundGuard.tsx:54–75 prioritizes loading over not-found. If immediate rejection of a missing required ID is desired, that should be an explicit, separately tested behavior change preserving optional-ID callers and navigation/deletion transitions.

    The proposed Export-page and HOC hardening addresses separate accesses; neither is necessary to repair this component’s demonstrated crash mechanism.

    No runtime reproduction was performed. Production confirmation was blocked by unavailable Sentry access. The event’s symbolicated frame and navigation/deep-link breadcrumbs are needed to establish the actual trigger; Settings_Profile metadata alone cannot do that.

    What alternative solutions did you explore? (Optional)

    Fixing navigation alone would leave the component vulnerable to malformed routes. Defensive extraction is the smallest crash-prevention change; identifying the production navigation trigger remains a separate investigation.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106883) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  10. 14 remaining items

  11. melvin-bot commented on Nov 15, 2026

    @melvin-bot
    Author

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  12. changed the title [-][$175] [Sentry: APP-P65] TypeError: Cannot read property 'reportID' of undefined in DynamicReportDetailsPage[/-] [+][Due for payment 2026-11-25] [$175] [Sentry: APP-P65] TypeError: Cannot read property 'reportID' of undefined in DynamicReportDetailsPage[/+] on Nov 18, 2026
  13. melvin-bot commented on Nov 18, 2026

    @melvin-bot
    Author

    @nyomanjyotisa

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.41-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-11-25. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  14. nyomanjyotisa commented on Nov 19, 2026

    @nyomanjyotisa
    Member

    Contributor+ Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: BT Migrate Report Core 1 #90113 (comment)
      Link to the comment on the Issue: [BT-129] Migrate Reports - Core (Part 1) #83365 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A — No core-flow interruption was established.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Precondition:

    • Sign in to the iOS App with a test account that can access an existing report. Note its report ID.

    Test:

    1. Open new-expensify://search/details without a report ID. Once loading finishes, verify Not Found appears and the App does not crash.
    2. Tap Go back. Verify you can continue using the App.
    3. Open new-expensify://search/details?reportID=<reportID> with the existing report ID. Verify the correct report details appear.

    Do we agree 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions