{"record":{"id":"f115c42252a6fb1f","repo":"weaviate/weaviate","slug":"failed-to-get-existing-posting-metadata-for-postin","errorCode":null,"errorMessage":"failed to get existing posting metadata for posting %d","messagePattern":"failed to get existing posting metadata for posting (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/hfresh/posting_map.go","lineNumber":122,"sourceCode":"func (v *PostingMap) SetVectorIDs(ctx context.Context, postingID uint64, posting Posting) error {\n\tif len(posting) == 0 {\n\t\terr := v.bucket.Delete(ctx, postingID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.deleteSlot(postingID)\n\t\treturn nil\n\t}\n\n\tvar pm PackedPostingMetadata\n\tfor _, vector := range posting {\n\t\tpm = pm.AddVector(vector.ID())\n\t}\n\tpm = pm.Compact()\n\n\texisting, err := v.bucket.Get(ctx, postingID)\n\tif err != nil && !errors.Is(err, ErrPostingNotFound) {\n\t\treturn errors.Wrapf(err, \"failed to get existing posting metadata for posting %d\", postingID)\n\t}\n\tif err == nil && bytes.Equal(pm, existing) {\n\t\t// no change, skip the update\n\t\tv.setSlot(postingID, pm)\n\t\treturn nil\n\t}\n\n\t// store the updated posting metadata on disk and update the in-memory cache\n\terr = v.bucket.Set(ctx, postingID, pm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tv.setSlot(postingID, pm)\n\n\treturn nil\n}\n","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/hfresh/posting_map.go#L104-L140","documentation":"SetVectorIDs reads the existing packed posting metadata from the bucket to skip no-op writes; this error wraps a bucket.Get failure other than ErrPostingNotFound when updating the vector-ID list of a posting. It means the posting-metadata bucket could not be read (I/O or internal error), so the update is aborted. ErrPostingNotFound is deliberately tolerated and does NOT produce this error.","triggerScenarios":"setPostingVectorIDs (called from doMerge and merge paths) -> PostingMap.SetVectorIDs with a non-empty posting, where v.bucket.Get(ctx, postingID) returns a real error (not ErrPostingNotFound).","commonSituations":"Disk I/O errors, LSM bucket corruption, or shutdown racing with a maintenance write.","solutions":["Inspect the wrapped inner error for the bucket-level cause.","Check disk health and shard directory integrity.","Retry the operation; SetVectorIDs assumes the caller holds the posting lock and is idempotent.","If persistent, restore the shard from backup or recreate the index."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := pm.SetVectorIDs(ctx, postingID, posting); err != nil {\n    // tolerate only ErrPostingNotFound-shaped absence; surface real I/O errors\n    if !errors.Is(err, ErrPostingNotFound) {\n        logger.Errorf(\"posting %d metadata update failed: %v\", postingID, err)\n    }\n}","preventionTips":["Distinguish ErrPostingNotFound (benign) from real bucket errors.","Run filesystem checks after unclean shutdowns.","Hold the posting lock as required before calling SetVectorIDs.","Monitor underlying LSM bucket error rates."],"tags":["go","vector-index","hfresh","bucket-io"],"backgroundTag":"posting-metadata-read-failed","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"}