{"record":{"id":"e218af52940394ea","repo":"weaviate/weaviate","slug":"failed-to-get-version-for-d","errorCode":null,"errorMessage":"failed to get version for %d","messagePattern":"failed to get version for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/hfresh/version_map.go","lineNumber":285,"sourceCode":"\nfunc (v *VersionStore) key(vectorID uint64) []byte {\n\tbuf := make([]byte, len(versionMapBucketPrefix)+8)\n\tcopy(buf, versionMapBucketPrefix)\n\tbinary.LittleEndian.PutUint64(buf[len(versionMapBucketPrefix):], vectorID)\n\treturn buf\n}\n\nfunc (v *VersionStore) Get(ctx context.Context, vectorID uint64) (VectorVersion, error) {\n\tkey := v.key(vectorID)\n\tbucket, release, err := v.bucket.acquire()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer release()\n\n\tversion, err := bucket.Get(key[:])\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(err, \"failed to get version for %d\", vectorID)\n\t}\n\n\tif len(version) == 0 {\n\t\treturn 0, ErrVectorNotFound\n\t}\n\n\treturn VectorVersion(version[0]), nil\n}\n\nfunc (v *VersionStore) Set(ctx context.Context, vectorID uint64, version VectorVersion) error {\n\tkey := v.key(vectorID)\n\tbucket, release, err := v.bucket.acquire()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer release()\n\n\treturn bucket.Put(key[:], []byte{byte(version)})","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/hfresh/version_map.go#L267-L303","documentation":"VersionStore.Get in the hfresh vector index reads a vector's version byte from the persistent LSMKV version bucket. This wrapped error is returned when the underlying bucket.Get call itself fails (I/O error, corrupted store, closed bucket, failed bucket acquisition path in wrapped form). It is distinct from ErrVectorNotFound, which is returned when the key simply has no stored version.","triggerScenarios":"Calling VersionStore.Get(ctx, vectorID) when the LSMKV bucket cannot be read: the bucket was acquired via v.bucket.acquire() successfully but bucket.Get(key[:]) fails due to disk I/O errors, a corrupted/unmounted store, a closed or shutting-down shard, or LSMKV internal read failures.","commonSituations":"Disk full or failing disk under the Weaviate persistence directory; shard being dropped or closed concurrently while a read is in flight; corrupted LSMKV segment files after an unclean shutdown; permission problems on the store directory after a container/volume migration.","solutions":["Check disk health and free space on the persistence data volume (dmesg, df).","Verify the shard/collection was not deleted or closed while clients were reading; retry after shard is available.","If the store is corrupted, restore the affected shard/collection from a backup or re-index the data.","Check file permissions/ownership of the Weaviate data directory (PERSISTENCE_DATA_PATH)."],"exampleFix":"// caller: distinguish 'not found' from real read failure\nversion, err := store.Get(ctx, vectorID)\nif err != nil {\n    if errors.Is(err, ErrVectorNotFound) {\n        // key absent — handle as missing, do not retry\n        return nil, errVectorMissing\n    }\n    // wrapped \"failed to get version for %d\" — storage-level, retry or alert\n    return nil, fmt.Errorf(\"version store read failed: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// Go: classify via errors.Is against the sentinel\nfunc isVectorNotFound(err error) bool { return errors.Is(err, ErrVectorNotFound) }\nfunc isStorageFailure(err error) bool {\n    return err != nil && !isVectorNotFound(err)\n}","tryCatchPattern":"version, err := store.Get(ctx, vectorID)\nif err != nil {\n    switch {\n    case errors.Is(err, ErrVectorNotFound):\n        // treat as absent vector\n    default:\n        // wrapped storage failure: retry with backoff / alert on persistence\n        return retryOrEscalate(err)\n    }\n}","preventionTips":["Monitor disk health and free space on the persistence volume.","Avoid deleting shards/collections while readers are active.","Restore corrupted shards from backups instead of forcing reads.","Run the node with correct ownership of PERSISTENCE_DATA_PATH."],"tags":["go","storage","lsmkv","vector-index","hfresh"],"backgroundTag":"storage-read-failure","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}