[Crashlytics] Navigation action not found crashes from unguarded navigate() (HouseholdFragment, AadhaarIdFragment and others) — 139 events

XMLWordPrintable

    • FLW Sprint 56
    • FLW Mobile App
    • Prod

      Summary

      IllegalArgumentException "Navigation action/destination … cannot be found from the current destination" from unguarded navigate() calls across many screens.

      Background / Context

      Source: Sakhi/Niramay Crashlytics RCA (Oct 12 – Nov 10 2026, latest release 2.13.0 (70)). RCA ref RCA-03, status: Probable Root Cause (stack traces not opened; trigger inferred). Code inspected: PSMRI/FLW-Mobile-App, main, commit f90f07c3. 139 events across 11 issues; 130 of them are on now-closed issues that main already guards (see below). Remaining open work is small but two new/active call sites still reproduce in 2.12.1–2.13.0.

      Problem Statement

      findNavController().navigate(...) runs when the NavController is already at, or past, the source destination (double tap, stale click, or a repeated state emission).

      Current Behaviour (Actual)

      Open issues:

      • HouseholdFragment.setUpEligibleCouple (HouseholdFragment.kt:80) — 2 / 1 — new in 2.13.0 — raw findNavController().navigate(it) still in main.
      • AadhaarIdFragment$onViewCreated$6 (AadhaarIdFragment.kt:140) — 3 / 3 — 2.12.1 — navigate inside a LiveData state.observe; crash destination is already aadhaarOtpFragment (suggests the state was delivered twice; resetState() is called before navigate).
      • VillageLevelFormsFragment:60 — 3 / 3 and DeathReportsFragment:55 — 1 / 1 — already use safeNavigate in main (fixed, last seen ≤ 2.12.1).

      Closed/muted issues in the window (all last seen ≤ 2.12.1): NewBenRegFragment (108 / 63 — now guarded with isAdded + currentDestination), AllHouseholdFragment (8 / 6), DiseaseControlFragment (6 / 6), MotherCareFragment (5 / 4), IncentivesFragment (1 / 1), SchedulerFragment (1 / 1), HouseholdMembersFragment (1 / 1).

      Existing helper: utils/NavigationExt.kt provides Fragment.safeNavigate() / NavController.safeNavigate() (checks resumed state and that the action is reachable), but adoption is piecemeal.

      Expected Behaviour / Requirement

      Repeated or stale taps/events must never crash; navigation executes at most once per intended action.

      User Story

      As a field user on a slow tablet, I want repeated taps to be handled safely, so that the app does not crash.

      Acceptance Criteria

      • Given HouseholdFragment and AadhaarIdFragment, When the user double-taps / the state is re-delivered, Then the app navigates once and does not crash (CAPA-11).
      • Given the closed-issue screens (AllHousehold, DiseaseControl, MotherCare, Incentives, Scheduler, HouseholdMembers), When inspected, Then every raw navigate() is replaced by safeNavigate (CAPA-11).
      • Given AadhaarIdFragment, When the screen rotates or resumes after success, Then navigation is not repeated (one-shot event instead of re-observable state) (CAPA-12).
      • Given CI, When a raw navigate() appears in a click listener, Then lint fails (CAPA-12).

      Business Rules / Validations

      None identified.

      Dependencies

      None.

      Impact / Affected Areas

      HouseholdFragment.kt, AadhaarIdFragment.kt (+ AadhaarOtp flow), NavigationExt.kt, and the closed-issue screens listed above.

      Out of Scope

      Navigation graph redesign.

      QA / Testing Considerations

      Double-tap on each affected screen on a slow tablet; rotate during Aadhaar OTP navigation; confirm no new IllegalArgumentException events on 2.13.x/3.0.

      Open Questions / Clarifications

      • Is the Aadhaar crash a double tap or a repeated LiveData emission (open the issue page)?
      • Scope of the lint rule in this ticket vs a separate one.

      Source: Sakhi_Niramay_Crashlytics_RCA.xlsx (RCA-03, CAPA-11, CAPA-12). RCA is a draft pending human confirmation.

              Assignee:
              Ishwar Chouhan
              Reporter:
              Shivani Garg
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: