Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiveError: This should not happen #883

Closed
lotusprey opened this issue Jan 13, 2022 · 3 comments
Closed

HiveError: This should not happen #883

lotusprey opened this issue Jan 13, 2022 · 3 comments
Labels
problem An unconfirmed bug.

Comments

@lotusprey
Copy link

On app start, the following error is thrown in the readFrame method of the BinaryReadImpl class:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub.

during:

await Hive.initFlutter();
await Hive.openBox('box_name'); // <- this line

Hive is loaded and a box is opened in main. I also have a background activity (handled by the workmanager package) that also loads hive and opens the same box. Usually the background activity is triggered on app start and I was getting the error for each of the 2 calls. I assumed that opening the box twice may be the problem, but after removing the background activity call, the issue persisted. Restarting the emulator didn't work too, but reinstalling the app completely fixed things.
Today I encountered this problem for the first time and I cannot pinpoint what I could have done to cause this.

Details

  • Device: Emulator
  • Platform: Android 11
  • Flutter version: 2.8.1
  • Hive version: 2.0.5
  • Hive Flutter version: 1.1.0
@lotusprey lotusprey added the problem An unconfirmed bug. label Jan 13, 2022
@elmdecoste
Copy link

We are having the same problem, it's blocking our android users from opening our application.

Details

Device: Physical Pixel 6
Platform: Android 12
Flutter version: 2.8.1
Hive version: 2.0.5
Hive Flutter version: 1.1.0

01-24 15:18:11.391  4698  4760 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub.
01-24 15:18:11.391  4698  4760 E flutter : #0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
01-24 15:18:11.391  4698  4760 E flutter : #1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
01-24 15:18:11.391  4698  4760 E flutter : #2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #4      HiveImpl._openBox (package:hive/src/hive_impl.dart:111)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #5      HiveImpl.openBox (package:hive/src/hive_impl.dart:139)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #6      Preferences.getInstance (package:app/util/preferences.dart:14)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #7      mainDelegate (package:app/main.dart:53)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter :
01-24 15:18:11.391  4698  4760 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub.
01-24 15:18:11.391  4698  4760 E flutter : #0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
01-24 15:18:11.391  4698  4760 E flutter : #1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
01-24 15:18:11.391  4698  4760 E flutter : #2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #4      HiveImpl._openBox (package:hive/src/hive_impl.dart:111)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #5      HiveImpl.openBox (package:hive/src/hive_impl.dart:139)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #6      Preferences.getInstance (package:app/util/preferences.dart:14)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter : #7      mainDelegate (package:app/main.dart:53)
01-24 15:18:11.391  4698  4760 E flutter : <asynchronous suspension>
01-24 15:18:11.391  4698  4760 E flutter :

@lotusprey
Copy link
Author

I just saw that this issue has already been reported (#872); sorry for not noticing this. Nonetheless, I will leave this open to indicate that the issue persists on later versions of flutter/hive. Unless, of course, a moderator decides that it's save to close this as a duplicate.

@themisir
Copy link
Contributor

Closed with #914.

Please upgrade to hive v2.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem An unconfirmed bug.
Projects
None yet
Development

No branches or pull requests

3 participants