Skip to content

Getting production crash on 0.83,Fatal Exception: java.lang.IllegalStateException addViewAt: failed to insert view [288] into parent [290] at index 0 #57017

Description

@mksmanishp

Description

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [288] into parent [290] at index 0

Steps to reproduce

crash on everywhere on production app

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [288] into parent [290] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [9134] into parent [9136] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [7394] into parent [7396] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [8126] into parent [8128] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [8528] into parent [8530] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [288] into parent [290] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [9636] into parent [9638] at index 0

Fatal Exception: java.lang.IllegalStateException
addViewAt: failed to insert view [21668] into parent [21670] at index 0

React Native Version

0.83

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 26.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 96.55 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 24.6.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.5.1
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.27812.49.2514.14217341
  Xcode:
    version: 26.4.1/17E202
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.1
    wanted: ^18.0.0
  react:
    installed: 19.2.0
    wanted: 19.2.0
  react-native:
    installed: 0.83.9
    wanted: ^0.83.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

# Crashlytics - 
# Application: com.medikabazaar.app
# Platform: android
# Version: 4.4.8 (40081)
# Issue: 9d403b57a0c545d05b17ace7c6a5ede5
# Session: 6A1CF19E030A000172B37ED8F9123701_DNE_0_v2
# Date: Mon Jun 01 2026 15:29:16 GMT+0530 (India Standard Time)

Fatal Exception: java.lang.IllegalStateException: addViewAt: failed to insert view [288] into parent [290] at index 0
       at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SurfaceMountingManager.java:426)
       at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.kt:122)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.kt:340)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.kt:246)
       at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.kt:93)
       at

MANDATORY Reproducer

https://github.com/mksmanish

Screenshots and Videos

No response

Activity

  1. react-native-bot commented on Jun 1, 2026

    @react-native-bot
    Collaborator

    Warning

    Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.

  2. react-native-bot commented on Jun 1, 2026

    @react-native-bot
    Collaborator

    Warning

    Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


    You can read more about about it on our website: How to report a bug.

  3. react-native-bot commented on Jun 1, 2026

    @react-native-bot
    Collaborator

    Warning

    Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.

  4. shameemkpofficial-git commented on Jun 4, 2026

    @shameemkpofficial-git

    @mksmanishp Please share your package.json for inspecting what packages are using.

  5. mksmanishp commented on Jun 5, 2026

    @mksmanishp
    Author

    this is my package.json file

    {
    "name": "",
    "version": "0.0.1",
    "private": true,
    "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "tsc": "tsc",
    "typecheck": "tsc --noEmit",
    "format": "prettier --check src || (echo 'Formatting files...' && prettier --write src)",
    "lint:fix": "eslint src --fix ",
    "iphone": "npm run ios -- --simulator='iPhone 16'",
    "pod-install": "cd ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install",
    "postinstall": "npx patch-package",
    "generate-apk": "cd android && ./gradlew assembleRelease",
    "android1": "react-native run-android --active-arch-only",
    "android:dev": "ENVFILE=.env.dev react-native run-android",
    "android:live": "ENVFILE=.env.live react-native run-android",
    "android:release:dev": "cd android && ENVFILE=.env.dev ./gradlew assembleRelease",
    "android:release:live": "cd android && ENVFILE=.env.live ./gradlew assembleRelease",
    "android:aab:live": "cd android && ENVFILE=.env.live ./gradlew bundleRelease"
    },
    "dependencies": {
    "@d11/react-native-fast-image": "^8.1.7",
    "@hookform/resolvers": "^3.4.0",
    "@invertase/react-native-apple-authentication": "^2.4.0",
    "@notifee/react-native": "9.1.8",
    "@react-native-async-storage/async-storage": "^2.0.0",
    "@react-native-clipboard/clipboard": "^1.16.0",
    "@react-native-community/netinfo": "^12.0.0",
    "@react-native-documents/picker": "^10.1.3",
    "@react-native-firebase/analytics": "^22.0.0",
    "@react-native-firebase/app": "^22.0.0",
    "@react-native-firebase/auth": "^22.0.0",
    "@react-native-firebase/crashlytics": "^22.0.0",
    "@react-native-firebase/messaging": "^22.0.0",
    "@react-native-google-signin/google-signin": "^11.0.0",
    "@react-native/gradle-plugin": "^0.83.0",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/material-top-tabs": "^6.6.5",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.9.17",
    "@reduxjs/toolkit": "^2.1.0",
    "@shopify/flash-list": "^2.0.0",
    "axios": "^1.16.1",
    "babel-plugin-module-resolver": "^5.0.2",
    "date-fns": "^4.1.0",
    "hyper-sdk-react": "^5.0.31",
    "mixpanel-react-native": "^3.0.1",
    "newrelic-react-native-agent": "^1.5.10",
    "react": "19.2.0",
    "react-hook-form": "^7.51.4",
    "react-native": "^0.83.0",
    "react-native-blob-util": "^0.21.2",
    "react-native-calendars": "^1.1314.0",
    "react-native-config": "^1.6.1",
    "react-native-default-preference": "^1.4.4",
    "react-native-device-info": "^11.0.0",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-fbsdk-next": "^12.1.4",
    "react-native-geocoding": "^0.5.0",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.31.0",
    "react-native-get-random-values": "^1.11.0",
    "react-native-gifted-charts": "^1.4.76",
    "react-native-image-picker": "^7.1.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-in-app-review": "^4.3.3",
    "react-native-intersection-observer": "^0.2.1",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-otp-verify": "^1.1.8",
    "react-native-pager-view": "^6.8.1",
    "react-native-permissions": "^4.1.1",
    "react-native-reanimated": "^4.3.0",
    "react-native-render-html": "^6.1.0",
    "react-native-safe-area-context": "^5.0.0",
    "react-native-screens": "^4.24.0",
    "react-native-share": "^12.0.9",
    "react-native-simple-toast": "^3.2.0",
    "react-native-size-matters": "^0.4.2",
    "react-native-svg": "^15.11.2",
    "react-native-tab-view": "^3.5.2",
    "react-native-toast-message": "^2.1.8",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-uuid": "^2.0.1",
    "react-native-webview": "^13.12.2",
    "react-native-worklets": "^0.9.1",
    "react-native-youtube-iframe": "^2.3.0",
    "react-redux": "^9.1.0",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.3.0",
    "uri-scheme": "^1.2.0",
    "web-streams-polyfill": "^4.0.0",
    "zod": "^3.23.8"
    },
    "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/plugin-transform-class-static-block": "^7.26.0",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "^18.0.0",
    "@react-native-community/cli-platform-android": "^18.0.0",
    "@react-native-community/cli-platform-ios": "^18.0.0",
    "@react-native/babel-preset": "^0.83.0",
    "@react-native/eslint-config": "0.83.0",
    "@react-native/metro-config": "^0.83.0",
    "@react-native/typescript-config": "0.83.0",
    "@rnx-kit/align-deps": "^3.0.6",
    "@trivago/prettier-plugin-sort-imports": "^4.3.0",
    "@types/react": "^19.0.0",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "prettier": "^2.8.8",
    "react-test-renderer": "19.2.0",
    "typescript": "5.0.4"
    },
    "hyperSdkIOSVersion": "2.2.1",
    "engines": {
    "node": ">=18"
    },
    "rnx-kit": {
    "kitType": "app",
    "alignDeps": {
    "requirements": [
    "react-native@0.76"
    ],
    "capabilities": [
    "animation",
    "babel-preset-react-native",
    "clipboard",
    "core",
    "core-android",
    "core-ios",
    "core/metro-config",
    "gestures",
    "html",
    "jest",
    "navigation/native",
    "netinfo",
    "react",
    "react-test-renderer",
    "safe-area",
    "screens",
    "storage",
    "webview"
    ]
    }
    }
    }

  6. fardad-dev commented on Jun 7, 2026

    @fardad-dev

    I am using 0.83.0, and I have this issue in release mode. I'm not sure about debug

  7. manishkumarmb commented on Jun 9, 2026

    @manishkumarmb

    @shameemkpofficial-git you got the solution for this,or which package is giving this error.

  8. sahiljena-jpg commented on Jul 27, 2026

    @sahiljena-jpg

    @mksmanishp found any solutions for this?

  9. manishkumarmb commented on Jul 27, 2026

    @manishkumarmb

    not yet,still getting this

  10. maciel-involves commented on Jul 27, 2026

    @maciel-involves

    Also facing this issue in 0.84.1

  11. sahiljena-jpg commented on Jul 28, 2026

    @sahiljena-jpg

    React native : #55177

    Reanimate : software-mansion/react-native-reanimated#7493 (comment)

    These might help, @mksmanishp if you are able to reproduce can you verify?

  12. philipheinser commented on Jul 31, 2026

    @philipheinser
    Contributor

    get the same error when flatlist has sticky headers enabled:

    Exception java.lang.IllegalStateException:
      at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt (SurfaceMountingManager.kt:389)
      at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute (IntBufferBatchMountItem.kt:122)
      at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue (MountItemDispatcher.kt:379)
      at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems$lambda$7$lambda$6 (MountItemDispatcher.kt:269)
      at com.facebook.react.fabric.mounting.MountItemDispatcher.$r8$lambda$4xp_oXLXKRRjXh_WfqmwhGWbzaM (MountItemDispatcher.kt)
      at com.facebook.react.fabric.mounting.MountItemDispatcher$$ExternalSyntheticLambda4.invoke (D8$$SyntheticClass)
      at com.facebook.react.internal.tracing.PerformanceTracer.trace (PerformanceTracer.kt:46)
      at com.facebook.react.internal.tracing.PerformanceTracer.trace (PerformanceTracer.kt:35)
      at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems (MountItemDispatcher.kt:250)
      at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems (MountItemDispatcher.kt:94)
      at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded (FabricUIManager.java:1624)
      at com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.kt:42)
      at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1 (ReactChoreographer.kt:58)
      at com.facebook.react.modules.core.ReactChoreographer.$r8$lambda$nSkFhrr5T7rop_XKwzlLov4NLLw (ReactChoreographer.kt)
      at com.facebook.react.modules.core.ReactChoreographer$$ExternalSyntheticLambda0.doFrame (D8$$SyntheticClass)
      at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1645)
      at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1656)
      at android.view.Choreographer.doCallbacks (Choreographer.java:1252)
      at android.view.Choreographer.doFrame (Choreographer.java:1177)
      at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1630)
      at android.os.Handler.handleCallback (Handler.java:1095)
      at android.os.Handler.dispatchMessageImpl (Handler.java:135)
      at android.os.Handler.dispatchMessage (Handler.java:125)
      at android.os.Looper.loopOnce (Looper.java:269)
      at android.os.Looper.loop (Looper.java:367)
      at android.app.ActivityThread.main (ActivityThread.java:9333)
      at java.lang.reflect.Method.invoke
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:566)
      at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:929)
    Caused by java.lang.IndexOutOfBoundsException:
      at android.view.ViewGroup.addInArray (ViewGroup.java:5432)
      at android.view.ViewGroup.addViewInner (ViewGroup.java:5319)
      at android.view.ViewGroup.addView (ViewGroup.java:5126)
      at android.view.ViewGroup.addView (ViewGroup.java:5066)
      at com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.kt:36)
      at com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.kt:20)
      at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt (SurfaceMountingManager.kt:381)
    
  13. hbordersTwitch commented on Sep 14, 2026

    @hbordersTwitch

    I have a similar crash, but my stack trace looks like:

    Fatal Exception: java.lang.IllegalStateException: addViewAt: failed to insert view [756100] into parent [379414] at index 18
           at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SurfaceMountingManager.kt:389)
           at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.kt:122)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.kt:379)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems$lambda$7$lambda$6(MountItemDispatcher.kt:269)
           at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.java:46)
           at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.java:35)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.kt:250)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.kt:94)
           at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1624)
           at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:42)
           at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(ReactChoreographer.java:58)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1036)
           at android.view.Choreographer.doCallbacks(Choreographer.java:846)
           at android.view.Choreographer.doFrame(Choreographer.java:776)
           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1023)
           at android.os.Handler.handleCallback(Handler.java:938)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loopOnce(Looper.java:201)
           at android.os.Looper.loop(Looper.java:288)
           at android.app.ActivityThread.main(ActivityThread.java:7941)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    
    Caused by java.lang.IndexOutOfBoundsException: index=18 count=17
           at com.facebook.react.views.view.ReactViewGroup.addInArray(ReactViewGroup.kt:818)
           at com.facebook.react.views.view.ReactViewGroup.addViewWithSubviewClippingEnabled$ReactAndroid_release(ReactViewGroup.kt:687)
           at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.kt:34)
           at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.kt:20)
           at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SurfaceMountingManager.kt:381)
           at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.kt:122)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.kt:379)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems$lambda$7$lambda$6(MountItemDispatcher.kt:269)
           at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.java:46)
           at com.facebook.react.internal.tracing.PerformanceTracer.trace(PerformanceTracer.java:35)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.kt:250)
           at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.kt:94)
           at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1624)
           at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:42)
           at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(ReactChoreographer.java:58)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1036)
           at android.view.Choreographer.doCallbacks(Choreographer.java:846)
           at android.view.Choreographer.doFrame(Choreographer.java:776)
           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1023)
           at android.os.Handler.handleCallback(Handler.java:938)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loopOnce(Looper.java:201)
           at android.os.Looper.loop(Looper.java:288)
           at android.app.ActivityThread.main(ActivityThread.java:7941)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    
  14. mn765 commented on Sep 18, 2026

    @mn765

    We hit this on 0.86.0 and captured what this issue is missing: a logcat showing what happens immediately before the fatal, plus a measured reproduction rate. I think it identifies the root cause.

    The crash is caused by the recovery two instructions earlier

    addViewAt already handles a missing ViewState softly — it logs a ReactNoCrashSoftException and returns. But returning skips the insert while Fabric's indices keep counting, so the parent's real childCount is now out of step with the indices the rest of the batch was computed against. The next insert into that same parent is the one that dies.

    Both lines, 23 ms apart:

    13:20:48.261 E/unknown:SurfaceMountingManager:MissingViewState:
      com.facebook.react.bridge.ReactNoCrashSoftException:
      Unable to find viewState for tag: [480] for addViewAt
    
    13:20:48.285 E/AndroidRuntime: FATAL EXCEPTION: main
      java.lang.IllegalStateException: addViewAt: failed to insert view [1712] into parent [482] at index 1
        at SurfaceMountingManager.addViewAt(SurfaceMountingManager.kt:389)
        at IntBufferBatchMountItem.execute(IntBufferBatchMountItem.kt:122)
        at MountItemDispatcher.dispatchMountItems(MountItemDispatcher.kt:250)
        at FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1624)
      Caused by: java.lang.IndexOutOfBoundsException: index=1 count=0
        at android.view.ViewGroup.addInArray(ViewGroup.java:5404)
    
    1. Batch inserts child 480 into parent 482. Tag 480 has no ViewState.
    2. The missing-ViewState branch logs and returns. Nothing is inserted.
    3. Parent 482 still has zero children when the next instruction inserts 1712 at index 1.
    4. addView throws.

    count=0 is the tell: it is not an off-by-one, it is a parent that received none of its children.

    View-tag topology at the crash

    • 482 — the failing parent: long-lived, low-numbered, child of 496 ← 530, in the root / tab-bar region
    • 480 — the skipped child: absent from the surface's view-state map entirely
    • 1712 — freshly created
    • 492, 500, 504, 506, 508 — all present with parentTag=null, orphaned

    A half-applied mount batch for a tab transition.

    Reproduction rate: 1 in 12 on a fixed binary

    Nondeterministic. Trigger: tapping a bottom-tab button while another tab's screen is fully mounted — in our case a screen with a nested tab bar, a horizontal carousel and a lazy list.

    Twelve attempts across four UI-test uploads of the same APK (same bytes, not merely the same commit), one crash. Nine of those twelve come from a second test that executes a byte-identical path through the same tap, so it is a controlled comparison of the same step rather than of different code.

    Correlated signal: EGL_emulation: app_time_stats: avg=23606.17ms count=1 — a single 23.6-second frame interval — logged 180 ms before the fatal batch. The crashing run also finished ~30% faster than the passing runs. Both suggest the device was badly stalled going into an unusually large or interleaved batch.

    Environment: RN 0.86.0, New Architecture, Hermes, Android 14 (API 34), Pixel 6 emulator, release build.

    Why the existing fixes do not cover it

    A question rather than a patch

    There seems to be a move toward converting hard throws in this class into soft exceptions with an early return — #57860 did it for removeViewAt, and #58527 proposes it for the placeholder case in addViewAt.

    If the trace above is right, that pattern has a systematic side effect: every silently skipped mutation leaves the native child count out of step with the indices the rest of the batch was computed against, so the crash relocates to the next instruction rather than going away. Our fatal is exactly that relocation.

    Two directions, and we genuinely cannot tell which is correct from outside the renderer's invariants:

    1. Clamp index to the parent's child count before addView — stops the crash, but trades it for silently wrong sibling ordering.
    2. Treat a skipped mutation as invalidating the remaining mutations for that parent in the batch — the remaining indices are known stale, but we have no idea what that costs.

    One detail if anyone does take (1): the bound has to be the view manager's getChildCount(parent), not ViewGroup.childCount. ReactClippingViewManager.getChildCount returns allChildrenCount when removeClippedSubviews is on, and that is the index space addView is being driven with — clamping to ViewGroup.childCount would clamp legitimate indices and misorder children on healthy clipping parents.

    Happy to supply the full logcat, the screen recording, or the complete hierarchy dump.

  15. mn765 commented on Sep 21, 2026

    @mn765

    Second occurrence, three days on, and one detail makes it much less random than I thought: the view tags are identical.

    Both crashes, same tags

    addViewAt: failed to insert view [1712] into parent [482] at index 1
    

    1712 into 482, at index 1 — byte for byte the same pair on 2026-09-18 and again on 2026-09-21, on different builds several days of commits apart. Preceded both times by the MissingViewState soft exception for a tag absent from the surface's view-state map, 23 ms before the first fatal and 5 ms before the second.

    That is not what a random mount race looks like. Parent 482 is a stable, structurally-identified container — low-numbered and long-lived, in the root / tab-bar region of our tree. Whatever this is, it recurs at the same position in the hierarchy.

    The trigger is switching bottom tabs, not one screen

    • 2026-09-18: tap on the profile tab, while a creator-profile screen was fully mounted
    • 2026-09-21: tap on the discover tab, bounds [0,1180][202,1238]

    Different destination, same container, same failing insert. In our app both are bottom-tab buttons in a React Navigation bottom tab navigator; the screen being left is a lazy-rendered tab screen with nested navigation.

    Why I think the identical tags matter

    If the fault were a general Fabric mount-ordering race, the tags should vary with whatever happened to be mounting. They do not. That points at a specific container repeatedly ending up with a stale child count — consistent with the mechanism in my earlier comment, where the missing-ViewState early return skips an insert and the next instruction into that same parent indexes past the end.

    It also suggests this is reproducible for anyone whose tab bar sits at a similar position in the tree, which may explain why #52027 and this issue both describe "random" crashes that nobody can pin down.

    Environment

    react-native 0.86.0, New Architecture / Fabric, Hermes, Android 14 (API 34), Pixel 6 emulator, release build. Both crashes on emulator; we have shipped 0.86 to 1% of production users and have not yet seen it there, which is consistent with it needing scheduling pressure the emulator supplies more readily.

    Happy to provide either full logcat, the recordings, or the hierarchy dumps — and if a maintainer wants a specific instrumented build run, we have a UI-test harness that hits this path repeatedly and can gather whatever would help.

  16. mn765 commented on Oct 3, 2026

    @mn765

    Hit on 0.86.0, with a causal chain read from the shipped SurfaceMountingManager.kt: a soft failure two instructions earlier leaves the parent with zero children, so the next insert at index 1 throws.

    No runnable reproducer — reason at the bottom. Posting because nobody in this thread has a diagnosis yet.

    The chain: the soft failure causes the hard one

    1. A mount batch asks to insert child 480 into parent 482. Tag 480 has no ViewState — it is absent from the 700-line hierarchy dump entirely.
    2. SurfaceMountingManager.kt:337 logs ReactNoCrashSoftException: Unable to find viewState for tag: [480] for addViewAt and returns silently. The insert never happens.
    3. Parent 482 therefore still has zero children when the very next instruction asks to insert 1712 at index 1.
    4. Line 389 throws IndexOutOfBoundsException: index=1 count=0, rethrown fatal.
    E/unknown:SurfaceMountingManager:MissingViewState:
      com.facebook.react.bridge.ReactNoCrashSoftException:
      Unable to find viewState for tag: [480] for addViewAt
    
    E/AndroidRuntime: FATAL EXCEPTION: main
      java.lang.IllegalStateException: addViewAt: failed to insert view [1712] into parent [482] at index 1
        at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SurfaceMountingManager.kt:389)
        at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute
        at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems
        at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded
      Caused by: java.lang.IndexOutOfBoundsException: index=1 count=0
    

    That explains the shape everyone is reporting: the thrown pair is always a low parent tag and a freshly created child, because the parent is a long-lived container whose earlier insert was dropped.

    Topology, trigger and rate

    Tag topology at the time. 482 ← 496 ← 530, a long-lived low-numbered container in the root/tab-bar region; 1712 freshly created; 492, 500, 504, 506, 508 all orphaned at parentTag=null. That is a half-applied mount batch for a tab transition.

    Trigger and conditions. A tab switch — tapOn the profile tab, 63 s into a session, not during any other operation. EGL_emulation: app_time_stats: avg=23606.17ms count=1, a single 23.6-second frame interval, is logged 180 ms before the fatal batch. The device was severely stalled going in. Our crashing run also finished in 115 s where passing runs take 158–167 s, so it is an outlier in duration as well as outcome.

    Reproduction rate: 1 in 12, on a byte-identical binary. Three repeat runs of the same APK gave nine clean passes, plus three more prefix-identical passes inside the crashing run itself. One flow in those runs is byte-identical through the failing step, so it is a control for that exact step.

    Why #58526's patch would not have helped

    On #58526 — it looks like the same bug by title but is a different branch. Its patch guards checkNotNull(view), i.e. an existing ViewState whose view is null. Ours is a ViewState that is absent entirely, which 0.86.0 already handles softly and correctly at line 337. That patch would not have saved us.

    The one guard that does not exist is a bounds check on index before addView. Clamping index to parentView.childCount would turn the crash into a soft exception, at the cost of silently wrong sibling ordering — a real trade in a renderer invariant, which is why we have not shipped it ourselves.

    Why no reproducer

    The bot's requirement is understood, and we cannot meet it: at 1-in-12 under a severe frame stall this does not survive reduction to an RNTesterPlayground.js. What makes it fire is the stall, not a component tree we could hand over. If a maintainer wants the full logcat, the hierarchy dump or the frame timings, say so and we will attach them.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Needs: Version Info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions