Repository navigation
Description
Version Number: 9.3.62-5+
Reproducible in staging?: Yes
Reproducible in production?: Unknown
Email or phone of affected tester (no customers): N/A
Issue reported by: Internal (found during investigation of #89028)
Device used: Android/iOS
Action Performed:
- Log in to the app
- Copy a conversation/chat link
- Log out from the app
- Open the conversation/chat link from step 2
- Log in to the app with the same account
- Observe the console
Expected Result:
Navigation to TabNavigator succeeds without errors; the user lands on the deep-linked report.
Actual Result:
Console error:
The action 'NAVIGATE' with payload {"name":"TabNavigator","params":{"initial":false,"screen":"ReportsSplitNavigator","params":{"pop":true,"initial":true,"screen":"Report","params":{"reportID":"..."},"path":"/r/..."},"pop":true},"pop":true} was not handled by any navigator.
Do you have a screen named 'TabNavigator'?
Root Cause Analysis
During the deep link login flow, openReportFromDeepLink awaits waitForProtectedRoutes(), which resolves when CONCIERGE appears in routeNames. However, TabNavigator is loaded lazily via getComponent, so there's a window where the RootStack has registered the screen name but the TabNavigator component hasn't fully mounted to handle the nested navigation action. The Navigation.navigate() call dispatches a NAVIGATE action targeting TabNavigator during this window, producing the unhandled action error.
Recommended Fix
Add NAVIGATORS.TAB_NAVIGATOR to the PROTECTED_SCREENS check (or add a separate readiness check that verifies TabNavigator is in the navigation state before resolving). This ensures waitForProtectedRoutes() doesn't resolve until TabNavigator is actually available to handle navigation.
Related Issues
- Chat - Compose box not displayed after logging in via chat link #89028 — original compose box issue (no longer reproducible, but this error was found during its investigation)
- [Due for payment 2026-08-06] [$250] After signing in with a new account, the home page appears instead of the room #85242 — same deep link login flow lands on wrong page
- [Due for payment 2026-07-31] [$250] Public Room Deeplink Does Not Open Correctly When User Is Signed Out (Android) #82013 — public room deep link fails for signed-out users on Android
Platforms:
- Android: App
- iOS: App
- Android: mWeb Chrome
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Screenshot from situchan's investigation in #89028:
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022059429287007822722
- Upwork Job ID: 2059429287007822722
- Last Price Increase: 2026-05-27
Activity
MelvinBot commentedon May 27, 2026
Proposal
What is the root cause of that problem?
waitForProtectedRoutes()(Navigation.ts:716) resolves as soon as'Concierge'appears instate.routeNames(Navigation.ts:702). However,routeNamesreflects declared<Stack.Screen>entries, not mounted components. SinceTabNavigatorandConciergeare both declared as siblings inAuthScreens.tsx, they appear inrouteNamessimultaneously — beforeTabNavigator'suseNavigationBuilderhas run and registered its action listener. Whennavigate()dispatches aNAVIGATEaction targeting a screen insideTabNavigator, no navigator is registered to handle it.Note: The issue body's suggested fix of adding
TAB_NAVIGATORtoPROTECTED_SCREENSwould not work —'TabNavigator'already appears inrouteNamesat the same instant as'Concierge', so it provides no additional timing signal.What changes do you think we should make in order to solve the problem?
Modify
navContainsProtectedRoutesto additionally verify thatTabNavigator's nested state hasstale === false, which only becomes true afteruseNavigationBuilderruns inside the mountedTabNavigatorcomponent:Both
NAVIGATORSandPROTECTED_SCREENSare already imported in this file. Thestale === falsepattern is already used in the codebase (e.g.,TabNavigator.native.tsx:63,usePreserveNavigatorState.ts:13).What alternative solutions did you explore?
Adding
TAB_NAVIGATORtoPROTECTED_SCREENS(as the issue suggests) — rejected becauserouteNamesreflects declared screens, not mounted ones, so both'Concierge'and'TabNavigator'appear simultaneously.Why stale === false is the right signal
When
NavigationContainerinitializes with a deep linkinitialState, the full navigation tree is pre-hydrated — includingTabNavigator's nested state. This pre-hydrated state is aPartialStatewherestaleis notfalse. WhenTabNavigatoractually mounts,useNavigationBuildercallsgetRehydratedState, which setsstale: falseand registers the navigator's action listener. Only then can dispatched actions be handled. The state change propagates up to the root, firing theonStateChangelistener thatwaitForProtectedRoutessubscribes to.Possibly related issues
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.KJ21-ENG commentedon May 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a signed-out user opens a report deep link and then logs in, the app sometimes dispatches the deferred report navigation too early. The navigation action targets
TabNavigator, but the native app logs an unhandledNAVIGATEaction instead of landing cleanly on the report.What is the root cause of that problem?
openReportFromDeepLink()waits forNavigation.waitForProtectedRoutes()before replaying the deep link after sign-in. That helper currently resolves as soon as the navigation state'srouteNamesincludesPROTECTED_SCREENS.CONCIERGE, based on the assumption that one protected screen name means the protected tree is ready.That is not strong enough for this flow. In
AuthScreens,TabNavigatoris registered as the first protected root stack screen but is loaded lazily withgetComponent={loadTabNavigator}. There is therefore a window where protected route names are present, but theTabNavigatorroute/nested state has not mounted far enough to handle the nested report navigation generated from the deep link. The deferredNavigation.navigate(route)then dispatches an action whose payload starts atTabNavigator, and React Navigation reports that no navigator handled it.What changes do you think we should make in order to solve the problem?
Tighten the readiness contract in
src/libs/Navigation/Navigation.ts. Instead of resolvingwaitForProtectedRoutes()from the presence ofCONCIERGEinrouteNamesalone, make the helper verify that the authenticated navigation tree includes an initializedNAVIGATORS.TAB_NAVIGATORroute before resolving. Concretely, updatenavContainsProtectedRoutes()to require both the protected route registration and a mountedTabNavigatorroute instate.routes, preferably with nestedstate/key present so it can receive targeted child navigation. Keep the listener behavior the same so the promise resolves on the next navigation state event once the tab navigator finishes mounting.This keeps the fix at the boundary that already promises "protected routes are ready" instead of adding another delay in
openReportFromDeepLink(). Add a focused unit test for the readiness helper if it is exported for testability, or cover the behavior throughwaitForProtectedRoutes()by simulating state events: it should not resolve when onlyCONCIERGEis inrouteNames, and it should resolve onceTabNavigatorexists as an initialized route.src/libs/Navigation/Navigation.ts—navContainsProtectedRoutes()/waitForProtectedRoutes()readiness check.Navigation.navigate()dispatch machinery.What alternative solutions did you explore? (Optional)
An alternative is to add a second wait only in
openReportFromDeepLink()before callingNavigation.navigate(route), but that would duplicate a readiness concern in one caller and leavewaitForProtectedRoutes()with a misleading contract. Another option is to makeTabNavigatoreager instead of lazy, but that increases startup cost for a race that can be solved by waiting for the existing lazy navigator to be mounted.melvin-bot commentedon May 27, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @daledah (
External)melvin-bot commentedon May 27, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022059429287007822722
[-]TabNavigator NAVIGATE action not handled during deep link login flow[/-][+][$250] TabNavigator NAVIGATE action not handled during deep link login flow[/+]lxyct825-ops commentedon May 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
[$250] TabNavigator NAVIGATE action not handled during deep link login flow
This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.
What is the root cause of that problem?
The stack trace shows the crash originates from a runtime error in the code:
The root cause is that the application code at
Do you have a screen named 'TabNavigator'?does not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.What changes do you think we should make in order to solve the problem?
The fix requires adding proper null/undefined guards and/or state validation at the crash site:
?.operator where applicable to safely access nested propertiesThe exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.
What alternative solutions did you explore? (Optional)
Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.
lxyct825-ops commentedon May 27, 2026
Contributor details
Your Expensify account email: lxyct825+expensify@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01174eaf71ab8fc150
melvin-bot commentedon May 27, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
aswin-s commentedon May 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On iOS and Android, when a user opens a deep link to a chat/report while logged out and then logs in with the same account, the console logs
The action 'NAVIGATE' ... was not handled by any navigator. Do you have a screen named 'TabNavigator'?and navigation to the deep-linked report can fail. Expected: navigation toTabNavigatorsucceeds and the user lands on the deep-linked report without errors.What is the root cause of that problem?
The deep-link navigate is gated behind
Navigation.waitForProtectedRoutes()(src/libs/actions/Link.ts:306), which resolves vianavContainsProtectedRoutes()(src/libs/Navigation/Navigation.ts:696-703). That predicate only checksstate.routeNames.includes(PROTECTED_SCREENS.CONCIERGE)(line 702). In react-navigation,routeNamesis the static list of declared screen names that is populated synchronously the moment theRootStack.Navigatorrenders (all screens inAuthScreens.tsx, includingCONCIERGEandTAB_NAVIGATOR, are declared together). It is not a signal that any screen has actually mounted.TAB_NAVIGATORis declared with a lazygetComponent={loadTabNavigator}and lives inpersistentScreens(AuthScreens.tsx:184-190). SowaitForProtectedRoutes()resolves as soon as the RootStack declares its screen names, thenNavigation.navigate()(Link.ts:362) dispatches aNAVIGATEtargeting the nestedTabNavigator → ReportsSplitNavigator → Reportchain beforeTabNavigatorhas mounted and registered its child navigator to handle the action — producing the unhandled-action error.What changes do you think we should make in order to solve the problem?
src/libs/Navigation/Navigation.ts:696-703— change the readiness signal innavContainsProtectedRoutesfrom inspectingstate.routeNames(declared names) to inspectingstate.routes(actually-mounted navigators), e.g. confirm a route whosenameisNAVIGATORS.TAB_NAVIGATORexists instate.routesbefore resolving, sinceTabNavigatoris the navigator that must handle the dispatched deep-linkNAVIGATE.waitForProtectedRoutes(Navigation.ts:716-734) intact; itsaddListener('state', ...)path will then continue waiting until the listener observes a state whereTabNavigatoris present inroutes, rather than resolving immediately on the first emitted state.NAVIGATORSinNavigation.tsif not already present, to referenceNAVIGATORS.TAB_NAVIGATORin the new check.Navigation.ts,AuthScreens.tsx, andSCREENS.tsare shared across iOS/Android/web; the fix applies to all platforms reproducing the error.What alternative solutions did you explore? (Optional)
Adding
NAVIGATORS.TAB_NAVIGATORtoPROTECTED_SCREENS(the issue's suggested fix) does not work: it would still be matched againstrouteNames, which already containsTabNavigatorat the same instant asConcierge, so the resolve timing is unchanged.wildan-m commentedon May 27, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
57 remaining items
melvin-bot commentedon Jul 14, 2026
@situchan / @daledah @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]
melvin-bot commentedon Jul 17, 2026
@situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jul 21, 2026
@situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
situchan commentedon Jul 21, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: N/A
[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
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
No need. Just console error not affecting production users
mallenexpensify commentedon Jul 23, 2026
@daledah from the C+ doc
@MelvinBot payment-review
MODE: <closed-no-pr | payment-due>
JOB_PRICE: 250 # override if the title bounty differs
Run the C+ payment framework for this issue and post a structured, evidence-cited
recommendation. Rules:
If MODE = closed-no-pr:
(<~8 non-bot comments AND no C+ engagement markers, or closed <48h, or spam/invalid),
return "$0 — skipped" with a one-line reason and STOP.
If MODE = payment-due:
truly attributable to this author/reviewer. If yes, −50% per verified regression.
If fault is unclear, DO NOT deduct — flag for human review.
scope expansion, core-flow changes, deploy blockers audited, performance,
test coverage, files touched), each backed by a permalink.
Output: recommended $ amount, per-line reasoning with permalinks, confidence
(High/Med/Low), and any manual-review flags.
MelvinBot commentedon Jul 23, 2026
🤖 C+ payment recommendation —
payment-due, JOB_PRICE = $250. Suggestion only; a human confirms before paying.Recommendation
daledahsituchanReasoning (every point cited)
One verified regression exists, and it reduces pay by 50%. The first fix, PR #91796, was merged then reverted because it broke 5 critical flows that share
waitForProtectedRoutes()(it hung on cold start). This was confirmed by the C+ themselves —daledahwrote "our PR #91796 was reverted because it has some regressions" and again that "the original PR was reverted". The revert spawned deploy blockers #92023, plus #92039/#92030/#92041/#92047 and a cold-start notification regression, all traced in the revert analysis. Per the C+ doc rule you quoted: a confirmed regression → −50%. All blockers trace to a single reverted PR / one root cause, so this is one regression event, not stacked.mallenexpensifyalso flagged "at least one regression".Attributed to
daledah.daledahis the issue assignee who directed and reviewed PR #91796 (authorMelvinBot, assigneedaledah; reviewers weredaledah/MelvinBot/yuwenmemon). The reverted fix is the one they own → −50% → $125 (ceil((0.5 × 250)/25) × 25 = 125).situchan— flag for human review, do not auto-deduct.situchanis not listed among the reviewers of the reverted PR #91796; they entered on the successful remediation, PR #92482 (deployed to production in 9.4.33-8, fixed all blockers). The framework says: when fault for a regression is unclear, do not deduct — flag it. So I'm not applying the −50% tosituchan. If you consider the issue's regression jointly owned by both C+, apply the same −50% → $125; otherwise $250. This is a judgment call for you as CM.No increases warranted. The second PR was remediation for the revert, not scope expansion or a bonus-worthy additional fix, so no increase factors apply.
Manual-review flags
MelvinBot(both PRs authored by it), and the payment summary lists two C+ each owed $250 as "Reviewer." Confirm both offers are intended before paying.situchanregression share: decide whether the Wait for TabNavigator mount before resolving waitForProtectedRoutes #91796 regression is jointly owned (→ $125) or onlydaledah's (→ $250). See above.situchan's BugZero checklist addresses the original console-error bug, not the Wait for TabNavigator mount before resolving waitForProtectedRoutes #91796 regressions.Confidence: High that a verified regression exists and is attributable to
daledah. Medium onsituchan's share (depends on your read of joint ownership).melvin-bot commentedon Jul 27, 2026
@situchan Huh... This is 4 days overdue. Who can take care of this?
mallenexpensify commentedon Jul 28, 2026
Payment Summary
Contributor: @daledah due $125 via NewDot
Contributor+: @situchan due $250 via NewDot
quinthar commentedon Aug 19, 2026
Approved $125 to @daledah
laurenreidexpensify commentedon Aug 24, 2026
$250 approved @situchan New Expensify