hive
hive copied to clipboard
HiveError: Could not read value from box. Maybe your box is corrupted.
Hi. I'm getting this exception in production, but I can't figure out why it is happening and I haven't been able to reproduce it in dev. Do you have any insights into when this exception is thrown?
It appears it happens when line 49 tries to access my box.
I'd appreciate any tips you think might be relevant. I've asked the same question to the dio_cache_manager dev, and he thinks you guys might be able to help.
I am also getting similar error while running my test in github ci windows box:
Failed to put vel: [[1691177347124887552]NO₂, [1691177349456920577]NO₂, [1691177350023151616]NO₂] pair in $nitrite_index|Employee|employeeNote.text|Fulltext
#0 StorageBackendVm.readValue.<anonymous closure> (package:hive/src/backend/vm/storage_backend_vm.dart:114:9)
<asynchronous suspension>
#1 StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:124:15)
<asynchronous suspension>
Caused by: HiveError: Could not read value from box. Maybe your box is corrupted.
I am using LazyBox
to store my data.
This error is intermittent and it is happening only in github ci windows box. In my Windows (x64) dev machine, I am not seeing this issue, also neither in my Ubuntu (x64) or MacOS (m2) machine. Hope this info helps.
I'm also encountering this same issue, using dio_cache_manager
with flutter_map. Did you ever solve this?
We are also seeing this error, here is our stacktrace:
HiveError: HiveError: Could not read value from box. Maybe your box is corrupted.
File "storage_backend_vm.dart", line 114, in StorageBackendVm.readValue.<fn>
File "<asynchronous suspension>"
File "future_impl.dart", line 41, in _AsyncCompleter.complete
File "<asynchronous suspension>"
File "lazy_box_impl.dart", line 32, in LazyBoxImpl.get
File "<asynchronous suspension>"
File "dio_cache_interceptor.dart", line 186, in DioCacheInterceptor._loadCacheResponse
File "<asynchronous suspension>"
File "dio_cache_interceptor.dart", line 47, in DioCacheInterceptor.onRequest
We also use Hive in other parts of our app but the stacktrace is always from the dio_cache_interceptor
same here we only got the issue while using dio_cache_interceptor
and also is always
dio_cache_interceptor_hive_store.dart
I will now try to create the HiveCacheStore
from dio_cache_interceptor
soon as the app starts. Previously we only created it when we needed it and my theory is that the HiveCacheStore
clean()
method is still running while it it is already being used, leading to this error as the value is removed and accessed at the same time.
I have the same issue reported via sentry many times
hive: 2.2.3
dio_cache_interceptor_hive_store:3.2.2
Update:
I got the same bug after deleting app, reinstalling it.