C4Error code 2 iOS Application Crash

Rarely, when running a query on both main and in the background, the app crashes.
What does c4error code 2 mean?

“Unimplemented”:

static constexpr const char* kLiteCoreNames[] = {
    // These must match up with the codes in the declaration of LiteCoreError
    "no error", // 0
    "AssertionFailed",
    "Unimplemented",
    "UnsupportedEncryption",

I’m seeing this occasionally happening on my application aswell,

is there a way to fix this?

Can you send a sample query(with code snippet) you are using?

There is no precise query, in the log below it happened when the application started, probably after the replicators started

Crashed: com.apple.main-thread
0 CouchbaseLiteSwift 0x1059d7358 std::__1::__hash_iterator<std::__1::__hash_node<litecore::Query*, void*> > std::__1::__hash_table<litecore::Query , std::__1::hashlitecore::Query*, std::__1::equal_tolitecore::Query*, std::__1::allocatorlitecore::Query* >::findlitecore::Query*(litecore::Query* const&) + 87 (__hash_table:87)
1 CouchbaseLiteSwift 0x1059d72c0 unsigned long std::__1::__hash_table<litecore::Query*, std::__1::hashlitecore::Query*, std::__1::equal_tolitecore::Query*, std::__1::allocatorlitecore::Query* >::__erase_uniquelitecore::Query*(litecore::Query* const&) + 2636 (__hash_table:2636)
2 CouchbaseLiteSwift 0x1059d6edc litecore::DataFile::unregisterQuery(litecore::Query*) + 122 (DataFile.hh:122)
3 CouchbaseLiteSwift 0x1059d6e80 litecore::Query::~Query() + 44 (Query.cc:44)
4 CouchbaseLiteSwift 0x105996728 litecore::SQLiteQuery::~SQLiteQuery() + 194 (SQLiteQuery.cc:194)
5 CouchbaseLiteSwift 0x105972b68 fleece::Retainedlitecore::repl::IncomingBlob::~Retained() + 96 (RefCounted.hh:96)
6 CouchbaseLiteSwift 0x1059867b8 c4Internal::C4QueryEnumeratorImpl::~C4QueryEnumeratorImpl() + 96 (RefCounted.hh:96)
7 CouchbaseLiteSwift 0x10598677c c4Internal::C4QueryEnumeratorImpl::~C4QueryEnumeratorImpl() + 23 (c4QueryEnumeratorImpl.hh:23)
8 CouchbaseLiteSwift 0x105ab66d0 cbl::QueryResultContext::~QueryResultContext() + 46 (CBLFleece.hh:46)
9 libobjc.A.dylib 0x19841cae0 object_cxxDestructFromClass(objc_object*, objc_class*) + 112
10 libobjc.A.dylib 0x1984328a4 objc_destructInstance + 88
11 libobjc.A.dylib 0x1984396ec _objc_rootDealloc + 52
12 libobjc.A.dylib 0x19843c574 AutoreleasePoolPage::releaseUntil(objc_object**) + 200
13 libobjc.A.dylib 0x19843c450 objc_autoreleasePoolPop + 208
14 UIKitCore 0x1869a7894 __processEventQueue + 6564
15 UIKitCore 0x18699eafc __eventFetcherSourceCallback + 156
16 CoreFoundation 0x184017bf0 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24
17 CoreFoundation 0x184017af0 __CFRunLoopDoSource0 + 204
18 CoreFoundation 0x184016e38 __CFRunLoopDoSources0 + 256
19 CoreFoundation 0x1840113e0 __CFRunLoopRun + 776
20 CoreFoundation 0x184010ba0 CFRunLoopRunSpecific + 572
21 GraphicsServices 0x19ad79598 GSEventRunModal + 160
22 UIKitCore 0x1869022f4 -[UIApplication _run] + 1052
23 UIKitCore 0x186907874 UIApplicationMain + 164
24 Eat 0x1023b4920 main + 4334700832 (:4334700832)
25 libdyld.dylib 0x183cef568 start + 4

It crashed when the Query’s ResultSet was released.
@Brunz Do you have info about the exception name from the crash log?

Sorry for the late reply, we haven’t been able to find a solution yet.
@pasin the exception name is EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000a11829090968.
Is there a way in swift to replicate the crash?
We can’t replicate it and it only happens to customers in production.

If you mean the name of the exception returned by Couchbaselite, I do not think it is handled or at least it is not returned to me by the logs