Skip to content

🐛 [cloud_firestore] Unknown app crash: FIRESTORE INTERNAL ASSERTION FAILED: value.has_value() #9252

@JoshRice1

Description

@JoshRice1

Bug report

Describe the bug
Not able to consistently reproduce but on iOS we have uses that are in crash loops with the following error.:

Fatal Exception: NSInternalInconsistencyException
FIRESTORE INTERNAL ASSERTION FAILED: value.has_value()

Note:
This issue has just come to light. We have been using this for 2+ years without an occurrence of this and wasn't until the last two updates that the issue started.

Steps to reproduce

Steps to reproduce the behavior:

Unclear as I haven't found to root cause due to the vagueness of the error.

Expected behavior

App does not crash and returns an error message that we can process

Sample project

N/A

Additional context

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x92d0c __exceptionPreprocess
1  libobjc.A.dylib                0x14ee4 objc_exception_throw
2  Foundation                     0x124df0 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3  Runner                         0xbb544 firebase::firestore::util::ObjcThrowHandler(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
4  Runner                         0xbaff0 firebase::firestore::util::Throw(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
5  Runner                         0x1063c4 firebase::firestore::util::internal::FailAssertion(char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*)
6  Runner                         0x106454 firebase::firestore::util::internal::FailAssertion(char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*)
7  Runner                         0x165cfc firebase::firestore::model::Mutation::CalculateOverlayMutation(firebase::firestore::model::MutableDocument const&, absl::lts_20211102::optional<firebase::firestore::model::FieldMask> const&)
8  Runner                         0x13fc40 firebase::firestore::local::LocalDocumentsView::RecalculateAndSaveOverlays(std::__1::unordered_map<firebase::firestore::model::DocumentKey, firebase::firestore::model::MutableDocument*, firebase::firestore::model::DocumentKeyHash, std::__1::equal_to<firebase::firestore::model::DocumentKey>, std::__1::allocator<std::__1::pair<firebase::firestore::model::DocumentKey const, firebase::firestore::model::MutableDocument*> > >&&)
9  Runner                         0x1403c0 firebase::firestore::local::LocalDocumentsView::RecalculateAndSaveOverlays(firebase::firestore::immutable::SortedSet<firebase::firestore::model::DocumentKey, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> > const&)
10 Runner                         0x14d904 std::__1::__function::__func<std::__1::enable_if<!(std::is_same<void, decltype(fp0())>::value), decltype(fp0())>::type firebase::firestore::local::Persistence::Run<firebase::firestore::local::LocalStore::AcknowledgeBatch(firebase::firestore::model::MutationBatchResult const&)::$_5>(absl::lts_20211102::string_view, firebase::firestore::local::LocalStore::AcknowledgeBatch(firebase::firestore::model::MutationBatchResult const&)::$_5)::'lambda'(), std::__1::allocator<std::__1::enable_if<!(std::is_same<void, decltype(fp0())>::value), decltype(fp0())>::type firebase::firestore::local::Persistence::Run<firebase::firestore::local::LocalStore::AcknowledgeBatch(firebase::firestore::model::MutationBatchResult const&)::$_5>(absl::lts_20211102::string_view, firebase::firestore::local::LocalStore::AcknowledgeBatch(firebase::firestore::model::MutationBatchResult const&)::$_5)::'lambda'()>, void ()>::operator()()
11 Runner                         0x131dac firebase::firestore::local::LevelDbPersistence::RunInternal(absl::lts_20211102::string_view, std::__1::function<void ()>)
12 Runner                         0x145b58 firebase::firestore::local::LocalStore::AcknowledgeBatch(firebase::firestore::model::MutationBatchResult const&)
13 Runner                         0x1a0be0 firebase::firestore::core::SyncEngine::HandleSuccessfulWrite(firebase::firestore::model::MutationBatchResult)
14 Runner                         0x18b7d8 firebase::firestore::remote::RemoteStore::OnWriteStreamMutationResult(firebase::firestore::model::SnapshotVersion, std::__1::vector<firebase::firestore::model::MutationResult, std::__1::allocator<firebase::firestore::model::MutationResult> >)
15 Runner                         0x1c9264 firebase::firestore::remote::WriteStream::NotifyStreamResponse(grpc::ByteBuffer const&)
16 Runner                         0x199674 firebase::firestore::remote::Stream::OnStreamRead(grpc::ByteBuffer const&)
17 Runner                         0xf9310 std::__1::__function::__func<firebase::firestore::remote::GrpcCompletion::Complete(bool)::$_0, std::__1::allocator<firebase::firestore::remote::GrpcCompletion::Complete(bool)::$_0>, void ()>::operator()()
18 Runner                         0x8eadc firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&)
19 Runner                         0x1ae15c firebase::firestore::util::Task::ExecuteAndRelease()
20 libdispatch.dylib              0x64094 _dispatch_client_callout
21 libdispatch.dylib              0xa73c _dispatch_lane_serial_drain$VARIANT$mp
22 libdispatch.dylib              0xb1f4 _dispatch_lane_invoke$VARIANT$mp
23 libdispatch.dylib              0x14ec8 _dispatch_workloop_worker_thread
24 libsystem_pthread.dylib        0x1e10 _pthread_wqthread
25 libsystem_pthread.dylib        0x193c start_wqthread


```---

Crashlytics thread:
Crashed: com.google.firebase.crashlytics.ios.exception
0  FirebaseCrashlytics            0x2236c FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393)
1  FirebaseCrashlytics            0x2274c FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424)
2  FirebaseCrashlytics            0x18730 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  FirebaseCrashlytics            0x12964 __FIRCLSExceptionRecord_block_invoke + 232 (FIRCLSException.mm:232)
4  libdispatch.dylib              0x64094 _dispatch_client_callout + 16
5  libdispatch.dylib              0x11964 _dispatch_lane_barrier_sync_invoke_and_complete + 52
6  FirebaseCrashlytics            0x1175c FIRCLSExceptionRecord + 234 (FIRCLSException.mm:234)
7  FirebaseCrashlytics            0x1240c FIRCLSExceptionRecordNSException + 126 (FIRCLSException.mm:126)
8  FirebaseCrashlytics            0x1135c FIRCLSTerminateHandler() + 398 (FIRCLSException.mm:398)
9  libc++abi.dylib                0x10274 std::__terminate(void (*)()) + 16
10 libc++abi.dylib                0x1021c std::terminate() + 60
11 libobjc.A.dylib                0x2846c objc::DenseMapBase<objc::DenseMap<objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >, objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >::FatalCorruptHashTables(objc::detail::DenseMapPair<objc_class*, PendingInitialize*> const*, unsigned int) const + 10
12 libdispatch.dylib              0x640a8 _dispatch_client_callout + 36
13 libdispatch.dylib              0xa73c _dispatch_lane_serial_drain$VARIANT$mp + 644
14 libdispatch.dylib              0xb1f4 _dispatch_lane_invoke$VARIANT$mp + 408
15 libdispatch.dylib              0x14ec8 _dispatch_workloop_worker_thread + 632
16 libsystem_pthread.dylib        0x1e10 _pthread_wqthread + 284
17 libsystem_pthread.dylib        0x193c start_wqthread + 8

### Flutter doctor

Run `flutter doctor` and paste the output below:

<details><summary>Click To Expand</summary>

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en-US)
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.69.2)
[✓] Connected device (3 available)
! Error: Apple’s iPhone is busy: Fetching debug symbols for Apple’s iPhone. Xcode will continue when Apple’s iPhone is finished. (code -10)
[✓] HTTP Host Availability

• No issues found!


</details>

---

### Flutter dependencies

Run `flutter pub deps -- --style=compact` and paste the output below:

<details><summary>Click To Expand</summary>

Dart SDK 2.17.6
Flutter SDK 3.0.5
reconxy_flutter 1.0.0+200

dependencies:

  • auth_buttons 3.0.0 [flutter flutter_svg google_fonts]
  • auto_size_text 3.0.0 [flutter]
  • cloud_firestore 3.4.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
  • cloud_functions 3.3.3 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
  • cupertino_icons 1.0.5
  • device_info_plus 4.0.1 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
  • extended_image 6.2.1 [extended_image_library flutter meta]
  • firebase_analytics 9.3.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
  • firebase_auth 3.6.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
  • firebase_core 1.20.0 [firebase_core_platform_interface firebase_core_web flutter meta]
  • firebase_crashlytics 2.8.6 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
  • firebase_dynamic_links 4.3.3 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
  • firebase_messaging 12.0.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
  • firebase_remote_config 2.0.13 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
  • firebase_storage 10.3.4 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
  • flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
  • flutter_app_badger 1.4.0 [flutter]
  • flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
  • flutter_native_splash 2.2.6 [args flutter flutter_web_plugins image js lint meta path universal_io xml yaml]
  • google_maps_flutter 2.1.10 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
  • google_sign_in 5.4.0 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web]
  • http 0.13.4 [async http_parser meta path]
  • intl 0.17.0 [clock path]
  • jiffy 5.0.0 [intl]
  • json_annotation 4.6.0 [meta]
  • json_serializable 6.3.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper]
  • location 4.4.0 [flutter location_platform_interface location_web]
  • package_info_plus 1.4.3 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
  • path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
  • pdfx 2.2.0 [flutter flutter_web_plugins plugin_platform_interface js device_info_plus uuid meta extension synchronized universal_platform photo_view vector_math]
  • provider 6.0.3 [collection flutter nested]
  • qr_code_scanner 1.0.0 [js flutter flutter_web_plugins]
  • share_plus 4.0.10 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
  • shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
  • the_apple_sign_in 1.1.1 [flutter]
  • url_launcher 6.1.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
  • youtube_player_flutter 8.1.0 [flutter flutter_inappwebview]

dev dependencies:

  • flutter_lints 2.0.1 [lints]
  • flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]

transitive dependencies:

  • _fe_analyzer_shared 43.0.0 [meta]
  • analyzer 4.3.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
  • archive 3.3.1 [crypto path]
  • args 2.3.1
  • async 2.8.2 [collection meta]
  • boolean_selector 2.1.0 [source_span string_scanner]
  • build 2.3.0 [analyzer async convert crypto glob logging meta path]
  • build_config 1.1.0 [checked_yaml json_annotation path pubspec_parse yaml]
  • characters 1.2.0
  • charcode 1.3.1
  • checked_yaml 2.0.1 [json_annotation source_span yaml]
  • clock 1.1.0
  • cloud_firestore_platform_interface 5.7.0 [collection firebase_core flutter meta plugin_platform_interface]
  • cloud_firestore_web 2.8.2 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
  • cloud_functions_platform_interface 5.1.12 [firebase_core flutter meta plugin_platform_interface]
  • cloud_functions_web 4.3.1 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
  • collection 1.16.0
  • convert 3.0.2 [typed_data]
  • crypto 3.0.2 [typed_data]
  • dart_style 2.2.3 [analyzer args path pub_semver source_span]
  • device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
  • device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
  • device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
  • device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
  • device_info_plus_windows 3.0.1 [device_info_plus_platform_interface ffi flutter win32]
  • extended_image_library 3.3.0 [crypto flutter http_client_helper path path_provider]
  • extension 0.5.0
  • fake_async 1.3.0 [clock collection]
  • ffi 2.0.1
  • file 6.1.2 [meta path]
  • firebase_analytics_platform_interface 3.3.0 [firebase_core flutter meta plugin_platform_interface]
  • firebase_analytics_web 0.4.2 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
  • firebase_auth_platform_interface 6.5.1 [collection firebase_core flutter meta plugin_platform_interface]
  • firebase_auth_web 4.2.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
  • firebase_core_platform_interface 4.5.0 [collection flutter flutter_test meta plugin_platform_interface]
  • firebase_core_web 1.7.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
  • firebase_crashlytics_platform_interface 3.2.12 [collection firebase_core flutter meta plugin_platform_interface]
  • firebase_dynamic_links_platform_interface 0.2.3+8 [firebase_core flutter meta plugin_platform_interface]
  • firebase_messaging_platform_interface 4.1.0 [firebase_core flutter meta plugin_platform_interface]
  • firebase_messaging_web 3.1.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
  • firebase_remote_config_platform_interface 1.1.12 [firebase_core flutter meta plugin_platform_interface]
  • firebase_remote_config_web 1.1.1 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]
  • firebase_storage_platform_interface 4.1.12 [collection firebase_core flutter meta plugin_platform_interface]
  • firebase_storage_web 3.3.2 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
  • flutter_inappwebview 5.4.3+7 [flutter]
  • flutter_plugin_android_lifecycle 2.0.7 [flutter]
  • flutter_svg 1.1.1+1 [flutter meta path_drawing vector_math xml]
  • flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
  • glob 2.1.0 [async collection file path string_scanner]
  • google_fonts 3.0.1 [flutter http path_provider crypto]
  • google_maps_flutter_platform_interface 2.2.1 [collection flutter plugin_platform_interface stream_transform]
  • google_sign_in_android 6.0.1 [flutter google_sign_in_platform_interface]
  • google_sign_in_ios 5.4.0 [flutter google_sign_in_platform_interface]
  • google_sign_in_platform_interface 2.2.0 [flutter quiver]
  • google_sign_in_web 0.10.2 [flutter flutter_web_plugins google_sign_in_platform_interface js]
  • http_client_helper 2.0.3 [http]
  • http_parser 4.0.1 [collection source_span string_scanner typed_data]
  • image 3.2.0 [archive meta xml]
  • js 0.6.4
  • lint 1.10.0
  • lints 2.0.0
  • location_platform_interface 2.3.0 [flutter meta plugin_platform_interface]
  • location_web 3.1.1 [flutter flutter_web_plugins http_parser js location_platform_interface meta]
  • logging 1.0.2
  • matcher 0.12.11 [stack_trace]
  • material_color_utilities 0.1.4
  • meta 1.7.0
  • mime 1.0.2
  • nested 1.0.0 [flutter]
  • package_config 2.1.0 [path]
  • package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
  • package_info_plus_macos 1.3.0 [flutter]
  • package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
  • package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
  • package_info_plus_windows 2.0.0 [package_info_plus_platform_interface ffi flutter win32]
  • path 1.8.1
  • path_drawing 1.0.0 [vector_math meta path_parsing flutter]
  • path_parsing 1.0.0 [vector_math meta]
  • path_provider_android 2.0.17 [flutter path_provider_platform_interface]
  • path_provider_ios 2.0.11 [flutter path_provider_platform_interface]
  • path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
  • path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
  • path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
  • path_provider_windows 2.1.0 [ffi flutter path path_provider_platform_interface win32]
  • petitparser 5.0.0 [meta]
  • photo_view 0.14.0 [flutter]
  • platform 3.1.0
  • plugin_platform_interface 2.1.2 [meta]
  • process 4.2.4 [file path platform]
  • pub_semver 2.1.1 [collection meta]
  • pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml]
  • quiver 3.1.0 [matcher]
  • share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
  • share_plus_macos 3.0.1 [share_plus_platform_interface flutter]
  • share_plus_platform_interface 3.0.3 [flutter meta mime plugin_platform_interface]
  • share_plus_web 3.0.1 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
  • share_plus_windows 3.0.1 [share_plus_platform_interface flutter meta url_launcher]
  • shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface]
  • shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
  • shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
  • shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
  • shared_preferences_platform_interface 2.0.0 [flutter]
  • shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
  • shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
  • sky_engine 0.0.99
  • source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml]
  • source_helper 1.3.2 [analyzer collection source_gen]
  • source_span 1.8.2 [collection path term_glyph]
  • stack_trace 1.10.0 [path]
  • stream_channel 2.1.0 [async]
  • stream_transform 2.0.0
  • string_scanner 1.1.0 [charcode source_span]
  • synchronized 3.0.0+2
  • term_glyph 1.2.0
  • test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
  • typed_data 1.3.1 [collection]
  • universal_io 2.0.4 [collection crypto meta typed_data]
  • universal_platform 1.0.0+1
  • url_launcher_android 6.0.17 [flutter url_launcher_platform_interface]
  • url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface]
  • url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface]
  • url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface]
  • url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface]
  • url_launcher_web 2.0.12 [flutter flutter_web_plugins url_launcher_platform_interface]
  • url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
  • uuid 3.0.6 [crypto]
  • vector_math 2.1.2
  • watcher 1.0.1 [async path]
  • win32 2.7.0 [ffi]
  • xdg_directories 0.2.0+1 [meta path process]
  • xml 6.1.0 [collection meta petitparser]
  • yaml 3.1.1 [collection source_span string_scanner]

</details>

---

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions