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: Cannot read, unknown typeId: 56. Did you forget to register an adapter? #1309

Open
senkia24 opened this issue Sep 3, 2024 · 5 comments

Comments

@senkia24
Copy link

senkia24 commented Sep 3, 2024

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();




@darielkurt
Copy link

@senkia24 you need to register the adapter of the Contact class model

https://docs.hivedb.dev/#/custom-objects/type_adapters?id=register-adapter

@uc-asa
Copy link

uc-asa commented Sep 17, 2024

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

@darielkurt
Copy link

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.

@stuart-rickard
Copy link

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.

@darielkurt
Copy link

@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.

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

No branches or pull requests

4 participants