HiveError: Cannot read, unknown typeId: 56. Did you forget to register an adapter?
Hello, We are using hive and flutter contacts.
We put the contacts to hive box with json format box.put(contact.id, contact.toJson()).
Some of ios users faced the HiveError: Cannot read, unknown typeId: 56. Did you forget to register an adapter? error on app start.
It still return error after app uninstall and reinstalled. How do users clear own hive db.
box.values
.toList()
.map((e) => Contact.fromJson(
Map.from(e.map((key, value) => MapEntry(key.toString(), value))),
))
.toList();
@senkia24 you need to register the adapter of the Contact class model
https://docs.hivedb.dev/#/custom-objects/type_adapters?id=register-adapter
Hey @darielkurt.
We also get almost same
Non-fatal Exception: FlutterError Exception: HiveError: Cannot read, unknown typeId: 115. Did you forget to register an adapter?
But we just have 4 adaptor.
And It works first time when open app, but when app goes to background and tries to coming back it throws this kind of non fatal and then there is no option to fix.
only uninstall or clearing data cache solves the problem.
Note: this issue we are getting only to few devices
Hey @darielkurt.
We also get almost same
Non-fatal Exception: FlutterError Exception: HiveError: Cannot read, unknown typeId: 115. Did you forget to register an adapter?But we just have 4 adaptor.
And It works first time when open app, but when app goes to background and tries to coming back it throws this kind of non fatal and then there is no option to fix.
only uninstall or clearing data cache solves the problem.
Note: this issue we are getting only to few devices
Can you keyword search "typeId: 115" or "115" on your project directory, then see if there are entries. If you did not find any then I don't know how to continue now.
I had a similar issue during development of an app, except the typeId was 33. Searched everywhere for this typeId but it didn't exist in the code. All the adapters were registered. Shut down and restarted everything, but the issue remained. I deleted the build assets and that didn't work.
I changed the name of the box which fixed it. Not sure whether you can do this with an installed app, but I think the issue is with a zombie typeId in the stored box. Possibly the build process does not check for zombies. I can volunteer to try to fix it but I probably don't have the skills as a beginner developer.
@stuart-rickard
I had a similar issue during development of an app, except the typeId was 33. Searched everywhere for this typeId but it didn't exist in the code. All the adapters were registered. Shut down and restarted everything, but the issue remained. I deleted the build assets and that didn't work.
I changed the name of the box which fixed it. Not sure whether you can do this with an installed app, but I think the issue is with a zombie typeId in the stored box. Possibly the build process does not check for zombies. I can volunteer to try to fix it but I probably don't have the skills as a beginner developer.
I had a similar issue too and it's because of that zombie or floating typeId, even hiveIds can replicate it too. I don't know if it is intentional made by Hive or it is really an issue.
I had a similar issue during development of an app, except the typeId was 33. Searched everywhere for this typeId but it didn't exist in the code. All the adapters were registered. Shut down and restarted everything, but the issue remained. I deleted the build assets and that didn't work.
I changed the name of the box which fixed it. Not sure whether you can do this with an installed app, but I think the issue is with a zombie typeId in the stored box. Possibly the build process does not check for zombies. I can volunteer to try to fix it but I probably don't have the skills as a beginner developer.
I have the same error and in my case it's also 33 when I tried to just open the Hive box. The actual type ID of my model is 0. I am only trying to access Hive from a VM-entrypoint callback.
My callback looks like this. Note that I have also initialized Hive in my main function as well. Watchlist is the name of the object.
@pragma('vm:entry-point')
void callbackDispatcher() {
Workmanager().executeTask((task, inputData) async {
// Open the Hive box
Hive.init(inputData!["appDocumentDirectory"]);
Hive.registerAdapter<Watchlist>(WatchlistImplAdapter());
final box = await Hive.openBox<Watchlist>(
HiveBoxes.BOX_WATCHLIST,
path: inputData["appDocumentDirectory"],
);
});
}
I gravely regret using this package. Had I known that this package is terrible at isolates I would have never use it. Such a simple thing that could go wrong.
Had I known that this package is terrible at isolates I would have never use it
Isolate support has been pre-released for hive_ce!
Get the pre-releases here:
hive_ce hive_ce_flutter hive_ce_generator
Please try out IsolatedHive in your projects and report any issues you may have. I want to make sure all potential issues are ironed out before I make a real release.