weaviate/weaviate · error

failed to get existing posting metadata for posting %d

Error message

failed to get existing posting metadata for posting %d

What it means

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.

Source

Thrown at adapters/repos/db/vector/hfresh/posting_map.go:122

func (v *PostingMap) SetVectorIDs(ctx context.Context, postingID uint64, posting Posting) error {
	if len(posting) == 0 {
		err := v.bucket.Delete(ctx, postingID)
		if err != nil {
			return err
		}
		v.deleteSlot(postingID)
		return nil
	}

	var pm PackedPostingMetadata
	for _, vector := range posting {
		pm = pm.AddVector(vector.ID())
	}
	pm = pm.Compact()

	existing, err := v.bucket.Get(ctx, postingID)
	if err != nil && !errors.Is(err, ErrPostingNotFound) {
		return errors.Wrapf(err, "failed to get existing posting metadata for posting %d", postingID)
	}
	if err == nil && bytes.Equal(pm, existing) {
		// no change, skip the update
		v.setSlot(postingID, pm)
		return nil
	}

	// store the updated posting metadata on disk and update the in-memory cache
	err = v.bucket.Set(ctx, postingID, pm)
	if err != nil {
		return err
	}

	v.setSlot(postingID, pm)

	return nil
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Inspect the wrapped inner error for the bucket-level cause.
  2. Check disk health and shard directory integrity.
  3. Retry the operation; SetVectorIDs assumes the caller holds the posting lock and is idempotent.
  4. If persistent, restore the shard from backup or recreate the index.
Defensive patterns

Strategy: try-catch

Try / catch

if err := pm.SetVectorIDs(ctx, postingID, posting); err != nil {
    // tolerate only ErrPostingNotFound-shaped absence; surface real I/O errors
    if !errors.Is(err, ErrPostingNotFound) {
        logger.Errorf("posting %d metadata update failed: %v", postingID, err)
    }
}

Prevention

When it happens

Trigger: 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).

Common situations: Disk I/O errors, LSM bucket corruption, or shutdown racing with a maintenance write.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/f115c42252a6fb1f. Report an issue: GitHub.