Skip to content

[$175] [Sentry: APP-MF6] NSDictionary setObject:forKeyedSubscript: key cannot be nil #102740

Closed

Description

@mountiny

Sentry

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

Impact (snapshot at filing)

  • Users (total since first seen): 6090
  • Events: 6818
  • Users (last 14d): not pulled separately — issue is 2 days old, so total ≈ 14d figure
  • First seen: 2 days ago (2026-09-29)
  • Last seen: now (ongoing, escalating)
  • Platform: iOS (HybridApp)
  • App version(s): seen from 9.4.90 through current production (9.4.97)
  • Affected route(s) (parameterized): /workspaces/:policyID
  • Mechanism: nsexception (NSInvalidArgumentException, fatal)

Stack trace (top frames, first-party only)

objc_exception_throw
__exceptionPreprocess
-[__NSDictionaryM setObject:forKeyedSubscript:]
_dispatch_call_block_and_release
_dispatch_client_callout

Crashing turbo module call: RNSentry.getNewScreenTimeToDisplay

Suspected cause

Likely surfaces in Sentry's own iOS instrumentation (RNSentry getNewScreenTimeToDisplay) when a key used to build a telemetry dictionary is nil. Needs investigation into the call site that triggers this screen-time measurement.

Reproduction

Unknown — see Sentry events linked from the Sentry issue.

Related

  • Sibling Sentry IDs: none identified
  • Prior GH issues: none found
Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @cretadn22

Activity

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

    @melvin-bot

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

  4. changed the title [-][Sentry: APP-MF6] NSDictionary setObject:forKeyedSubscript: key cannot be nil[/-] [+][$175] [Sentry: APP-MF6] NSDictionary setObject:forKeyedSubscript: key cannot be nil[/+] on Oct 1, 2026
  5. melvin-bot commented on Oct 1, 2026

    @melvin-bot
  6. MelvinBot commented on Oct 1, 2026

    @MelvinBot
    Contributor

    ⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.

    I think RNSentry.getNewScreenTimeToDisplay is a misleading label, not the crash site. Some native code on the main queue writes dict[nil] = value right after a user navigates to /workspaces/:policyID. The best match in readable code is Sentry's unguarded setTagValue:forKey: (SentryScope.m:359-368). It is reached through RNSentry.setTag (RNSentry.mm:783-787), which has no nil check. However, I found no App code that passes a nil tag key.

    I couldn't confirm this because the stack in the issue drops the frames between setObject:forKeyedSubscript: and _dispatch_call_block_and_release. I also couldn't reach Sentry from this run.

    To confirm, someone with Sentry access should check:

    1. The image name (Sentry, RNSentry, FullStory, or the main HybridApp binary) of the frame just below setObject:forKeyedSubscript: in a few APP-MF6 events.
    2. Events per release per day. Did 9.4.90–9.4.93 users only start crashing on Sep 29? If so, the trigger is runtime or server data, not an App code change.
    3. The breadcrumbs just before the crash.

    What to do based on that frame:

    • Sentry / RNSentry setTag: add a patch-package patch so setTag returns early when key == nil, and report it upstream.
    • FullStory: guard the FS.Page / setUserVars calls in App (NavigationRoot.tsx:65-76) and escalate to FullStory.
    • Main HybridApp binary: the fix is outside the App repo, so an internal engineer needs to pick it up.
    Investigation details

    Why the turbo module label is misleading

    • Sentry 8.25.0 wraps only the RNSentry TurboModule for crash attribution. A call stays "active" until its promise settles.
    • getNewScreenTimeToDisplay runs on every navigation. Natively it only starts a CADisplayLink and resolves on the next frame (RNSentryTimeToDisplay.m:97-126). It uses setObject:forKey:, not keyed subscript, and guards a nil screenId.
    • So any main-queue crash in the first frame after a navigation gets this label.
    • RNSentry's methodQueue is the main queue (RNSentry.mm:81-84). That matches the _dispatch_call_block_and_release frames.

    Candidates considered

    • Sentry setTagValue:forKey: matches the exact selector and message. All App tag keys are defined constants, though, and React Native patch 042 makes JSI strings convert to @"" instead of nil.
    • FullStory SDK (closed source). On every navigation, App calls FS.Page(...).start() and logs a Page_viewed event. Its native bridge dispatches main-queue blocks that end inside the binary SDK. That fits the shape and timing, but I couldn't verify it. App-side FullStory code is unchanged from 9.4.84 to 9.4.97.
    • HybridApp native code outside this repo. I couldn't inspect it.

    Timeline

    Possibly related: [$175] [Sentry: APP-2AP] RNSNavigationController pushes same screen instance twice is another new iOS navigation crash filed the same day.


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis. Pasting the full raw stack of one event would let me identify the crash site.


    view run

  7. mountiny commented on Oct 1, 2026

    @mountiny
    ContributorAuthor

    @cretadn22 can you please review the proposal from Melvin?

  8. cretadn22 commented on Oct 1, 2026

    @cretadn22
    Contributor

    @mountiny Melvin's analysis didn't pinpoint the exact root cause or a definitive solution. Since this touches Sentry, we likely need someone from the expert contributor team to take over and investigate further.

  9. mountiny commented on Oct 2, 2026

    @mountiny
    ContributorAuthor

    @sosek108 Is this something you could take a look into please?

  10. sosek108 commented on Oct 5, 2026

    @sosek108
    Contributor

    @mountiny Of course. I'll check this

  11. sosek108 commented on Oct 5, 2026

    @sosek108
    Contributor

    On September 28, 2026, a routine configuration cleanup unexpectedly caused a large number of iOS applications using the Google Analytics for Firebase (GA4F) SDK to crash.

    https://firebase.blog/posts/2026/10/firebase-analytics-outage

    Mentioned issue occured only in one window Sep 29 00:40 - Sep 29 02:50 UTC. No occurance before, no after. And this correlates with global Firebase outage. Here is related issue Firebase IOS SDK issue: firebase/firebase-ios-sdk#16728.

    Nothing to do on our side as it was already handled on Google side

  12. cretadn22 commented on Oct 5, 2026

    @cretadn22
    Contributor

    Thank you. Let's keep this issue open for another week to monitor Sentry for any further occurrences. If it doesn't happen again, we can close it

  13. melvin-bot commented on Oct 8, 2026

    @melvin-bot

    @cretadn22 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  14. cretadn22 commented on Oct 9, 2026

    @cretadn22
    Contributor

    Thank you. Let's keep this issue open for another week to monitor Sentry for any further occurrences. If it doesn't happen again, we can close it

  15. cretadn22 commented on Oct 12, 2026

    @cretadn22
    Contributor

    @mountiny no new occruence in the last 12 days. Let's close this issue

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.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