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: Wrong checksum in hive file. Box may be corrupted. #36

Closed
zhangjianguo1 opened this issue Aug 24, 2022 · 2 comments
Closed

Comments

@zhangjianguo1
Copy link

Describe the bug

_diskCache = newHiveCache(
      path,
      cacheName: name,
      maxEntries: diskCountLimit,
      expiryPolicy: diskAgeLimit != null ? ModifiedExpiryPolicy(diskAgeLimit) : null,
      evictionPolicy: const LruEvictionPolicy(),
    );

invoke _diskCache.keys then got this error:

HiveError: Wrong checksum in hive file. Box may be corrupted.
#0 StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:97)

Version
stash: 2.0.2
stash_hive: 2.0.2

Flutter 2.5.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 3595343e20 (11 months ago) • 2021-09-30 12:58:18 -0700
Engine • revision 6ac856380f
Tools • Dart 2.14.3

@ivoleitao
Copy link
Owner

I think this is related with this PR in Hive. The version that you are using of stash_hive is very old and depends on hive 2.0.2. From the PR it seems this hive bug was fixed on 2.0.6 version of hive. I believe you have two alternatives:

  • Try to override hive version with a most recent one (try 2.0.6)
  • Upgrade to a more recent version of stash (the latest version depends on hive 2.2.3)

@zhangjianguo1
Copy link
Author

Thanks, I solved my problem with 'crashRecovery: true'. However, some data will be lost.

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

2 participants