Skip to content

[Due for payment 2026-09-03] [Sentry: APP-JQQ] HybridApp iOS crash opening a universal link — app.keyChain null in TryNewDotManager.navigateToNewDot #98104

Closed

Description

@mountiny

Sentry

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

Impact (snapshot at filing)

  • Users (last 7d): 5
  • Users (total since first seen): 5
  • Events: 18
  • First seen: 2026-08-02
  • Last seen: 2026-08-08
  • Platform: iOS (HybridApp)
  • App version(s): 9.4.49-3
  • Mechanism: nsexception (fatal, uncaught)
  • Culprit: -[YAPL logException:], YAPL function navigateToNewDot

Stack trace (top frames, first-party only)

navigateToNewDot@app/libs/TryNewDotManager.js:310:54
    app.keyChain.getPassword
@app/libs/DeepLinkManager.js:53:94

Native frames leading in:

-[ExpensifyAppDelegate application:continueUserActivity:restorationHandler:]
DeepLinkManager.handleUniversalLink
+[YAPLJS callFunction:args:]
-[JSValue callWithArguments:]
-[YAPL logException:]

Suspected cause

Opening a universal link routes through DeepLinkManager.handleUniversalLink, which calls TryNewDotManager.navigateToNewDot. That function reads app.keyChain.getPassword at line 310, and app.keyChain is null at that moment, so the app crashes on the deep link.

continueUserActivity can fire before the app finishes initialising, which would explain a null keychain: the deep link handler runs against a partly constructed app object. Worth confirming whether the crash correlates with a cold start from a link.

The fix is to guard app.keyChain in navigateToNewDot and defer the navigation until initialisation completes, rather than reading through a null.

Reproduction

Unknown. To approximate it: force-quit the app, then open an Expensify universal link so the app cold starts directly into continueUserActivity.

Related

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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 9, 2026
  2. melvin-bot commented on Aug 9, 2026

    @melvin-bot

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

  3. melvin-bot commented on Aug 9, 2026

    @melvin-bot
  4. MelvinBot commented on Aug 9, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause (Medium confidence): On a cold start, iOS delivers the universal link through application:continueUserActivity: before the HybridApp shell finishes initialising. That fires DeepLinkManager.handleUniversalLink → TryNewDotManager.navigateToNewDot, which dereferences app.keyChain.getPassword while app.keyChain is still null → fatal uncaught NSException. The reporter's hypothesis in the description matches the stack trace, and the mechanism (deep-link handler running against a partly-constructed app) is self-consistent.

    ⚠️ The fix is not in this repo — please route it internally. The crashing code (TryNewDotManager.js, DeepLinkManager.js, YAPL bridge) lives in Mobile-Expensify (the OldDot/HybridApp shell), not Expensify/App. I confirmed Expensify/App's src/libs/ has no navigateToNewDot / getPassword — its equivalent is the unrelated src/libs/TryNewDotUtils.ts. Because the fix requires changes in a repo outside App, an External/Upwork contributor can't implement it. This should be handled by an internal engineer with HybridApp access rather than the current external assignment.

    Recommended fix direction (for whoever picks it up internally):

    1. Null-guard app.keyChain in navigateToNewDot before reading getPassword.
    2. If the shell isn't fully initialised yet, queue the pending deep link and replay it once init (keychain) completes, instead of navigating through a null.
    Investigation details
    • Impact: 5 users / 18 events, iOS HybridApp only, v9.4.49-3, first seen 2026-08-02. Low volume, consistent with a cold-start-from-link race rather than a common path.
    • Not reproducible in this environment: this is an iOS-native continueUserActivity cold start. It can't be reproduced on web (or exercised via the JS-only App codebase), so I did not run a UI test — verification needs an iOS device that cold-starts directly into a universal link (force-quit the app, then open an Expensify universal link).
    • Could not independently verify line numbers: I don't have read access to Mobile-Expensify, so the :310 / :53 references and the code shape are taken from the crash report, not confirmed against source. That's the main reason this is Medium and not High confidence.
    • Related: a related internal issue on the same DeepLinkManager → TryNewDotManager path is already linked in the description; they may share a root cause. Parent tracker is [Tracking] Top Sentry crashes monthly check-in #91302.

    Next Steps for Contributor+ team:
    Because the fix lives in Mobile-Expensify (private), this isn't actionable as an external/Upwork task — please re-route to an internal HybridApp engineer. Reply with @MelvinBot <feedback> to refine this analysis.

  5. linhvovan29546 commented on Aug 10, 2026

    @linhvovan29546
    Contributor

    I think @MelvinBot's proposed fix would prevent the crash, but I don't think it's sufficient as described:

    1. The null-guard needs to do more than avoid the crash. Simply guarding app.keyChain.getPassword() isn't enough on its own, navigateToNewDot also builds hybridAppSettings.hybridApp.useNewDotSignInPage: !app.isSignedIn(), which is sent to NewDot to tell it whether OldDot already has valid credentials to share. If we guard the keychain access but still report useNewDotSignInPage: false (since isSignedIn() alone is still true), NewDot will assume it can rely on OldDot's session and silently proceed without ever receiving working credentials, trading a crash for a broken, unrecoverable session instead of an actual fix.

    2. "Queue the pending deep link and replay once init completes" doesn't match how initialization actually works here. Expensify.getInstance()'s constructor runs entirely synchronously, by the time it returns, keyChain is already either created or permanently null for that session. There's no async initialization step afterward for a queued deep link to usefully wait on; nothing in the normal app flow ever retries keychain creation short of a full fresh sign-in. This isn't a timing/race issue that resolves with a delay, it's a data-consistency gap between authToken and deviceLoginID/keychain that persists indefinitely once triggered.

  6. MelvinBot commented on Aug 10, 2026

    @MelvinBot
    Contributor

    You're right on both counts — thanks for the correction. I'll retract the "defer and replay" idea and reframe.

    On (1) — the guard is insufficient, and the App side confirms why. The NewDot handshake keys entirely off useNewDotSignInPage, so reporting false while OldDot has no shareable credentials produces exactly the silent broken session you describe:

    So the real fix isn't "guard the keychain read" — it's making useNewDotSignInPage reflect actual credential shareability, not just isSignedIn(). When the keychain / deviceLoginID is missing, OldDot should send useNewDotSignInPage: true so NewDot falls back to its own sign-in flow instead of silently trusting a session it will never receive.

    On (2) — agreed, it's a data-consistency gap, not a race. If getInstance() is fully synchronous and keychain is either created or permanently null by the time it returns, then there's nothing to wait on and queuing is pointless — I withdraw that. That reframes the underlying question to: how does the app end up with a valid authToken but a null deviceLoginID/keychain, and should that divergence be repaired rather than just handled at read time? Making useNewDotSignInPage credential-aware stops the crash and the broken session, but it treats the symptom; whatever lets the two diverge and persist is worth a separate look (e.g. whether a failed keychain creation should also invalidate the session so they can't drift apart).

    Both the navigateToNewDot change and that deeper consistency question live in Mobile-Expensify (private), which I can't read or verify — so I'm deferring to your read of the getInstance() / keychain lifecycle there, and the internal engineer picking this up should own that side. The NewDot-side contract above is the part I can confirm from the public App repo.

  7. Julesssss commented on Aug 10, 2026

    @Julesssss
    Contributor

    @linhvovan29546 agreed good points

    Also yaplSetSendAuthTokenCallback sets accountInfo.authToken and nothing else, and NewDot fires it on every SESSION write, whereas signInToOldDot (that would create the keychain) early returns if autoGeneratedLogin (or pass) is null, here

  8. 31 remaining items

  9. linhvovan29546 commented on Aug 31, 2026

    @linhvovan29546
    Contributor

    The PR was deployed in version 9.4.63-1.

  10. linhvovan29546 commented on Sep 2, 2026

    @linhvovan29546
    Contributor

    @mountiny @Julesssss Can you please add the Payment label? The payment due date should be September 4, 2026.

  11. changed the title [-][Sentry: APP-JQQ] HybridApp iOS crash opening a universal link — app.keyChain null in TryNewDotManager.navigateToNewDot[/-] [+][Due for payment 2026-09-03] [Sentry: APP-JQQ] HybridApp iOS crash opening a universal link — app.keyChain null in TryNewDotManager.navigateToNewDot[/+] on Sep 3, 2026
  12. melvin-bot commented on Sep 3, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Sep 3, 2026

    @melvin-bot

    Payment Summary

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. linhvovan29546 commented on Sep 4, 2026

    @linhvovan29546
    Contributor

    No check list needed

    This is a generic flow, so I don’t think we need to regression test it.

  15. mallenexpensify commented on Sep 4, 2026

    @mallenexpensify
    Contributor

    @MelvinBot why wasn't the associated PR linked above in the payment summary?

  16. mallenexpensify commented on Sep 4, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @linhvovan29546 due $250 via NewDot

  17. MelvinBot commented on Sep 4, 2026

    @MelvinBot
    Contributor

    The fix PR lives in a different repo, so there was nothing for the automation to link. melvin-bot builds the Resolving PRs section from PRs in Expensify/App that link the issue. This bug was fixed in Expensify/Mobile-Expensify#14064 (deployed in 9.4.63-1), and nothing connects that PR to this issue in the issue timeline — no cross-reference or "connected" event. The only place it appears is inside linhvovan29546's comment body, which the automation doesn't read.

    Compare with Expensify/App#99719, where the fix was an App PR: its payment summary does include a Resolving PRs: line. This issue's summary just omitted the section because the list came back empty.

    Note the issue also had to be reopened manually on 2026-08-28 — same root cause, since GitHub doesn't auto-close across repos.

    Evidence
    • This issue's timeline has exactly one cross-referenced event: Expensify/App#91302 (the Sentry tracking issue). No PR is linked.
    • Expensify/App#99719 timeline shows Expensify/App#99783 cross-referenced, and that PR is the one listed in its payment summary.
    • I can't read the exact melvin-bot logic — that repo isn't public — so the mechanism above is inferred from behavior across issues rather than from source. The observable fact is solid though: no linked PR existed for this issue.

    If you want the link in the record, the simplest fix is to add it by hand to the payment summary, or have the Mobile-Expensify PR reference Expensify/App#98104 in its description so a cross-reference gets created.


    view run · view recording

  18. twisterdotcom commented on Sep 5, 2026

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions