weaviate/weaviate · error
failed to upsert new centroid %d
Error message
failed to upsert new centroid %d
What it means
When the first vector finds no candidate postings, HFresh creates an initial posting: it allocates a posting ID and inserts a Centroid (the vector itself) into the Centroids index. This error wraps a failure of h.Centroids.Insert for the new posting ID.
Source
Thrown at adapters/repos/db/vector/hfresh/insert.go:191
targets, _, err := h.RNGSelect(v, 0)
if err != nil {
return nil, err
}
// if no postings were found, create a new posting while holding the lock
if targets.Len() == 0 {
postingID, err := h.IDs.Next()
if err != nil {
return nil, err
}
// use the vector as the centroid and register it in the SPTAG
err = h.Centroids.Insert(postingID, &Centroid{
Uncompressed: v,
Compressed: compressed,
Deleted: false,
})
if err != nil {
return nil, errors.Wrapf(err, "failed to upsert new centroid %d", postingID)
}
// return the new posting ID
targets = NewResultSet(1)
targets.data = append(targets.data, Result{ID: postingID, Distance: 0})
}
return targets, nil
}
// Append adds a vector to the specified posting.
// It returns true if the vector was successfully added, false if the posting no longer exists.
// It is called synchronously during imports but also asynchronously by reassign operations.
func (h *HFresh) append(ctx context.Context, vector Vector, centroidID uint64, reassigned bool) (bool, error) {
h.postingLocks.Lock(centroidID)
// check if the posting still exists
if !h.Centroids.Exists(centroidID) {
// the posting might have been deleted concurrently,View on GitHub (pinned to 75aa4b6d11)
Solutions
- Inspect the wrapped Centroids.Insert error for the storage-level cause.
- Check disk space and store health for the shard.
- Retry the insert; ensureInitialPosting re-checks for concurrent postings under the lock before creating one.
- If the centroid store is corrupted, restore the shard from backup.
Defensive patterns
Strategy: retry
Try / catch
if err := idx.Add(ctx, id, vec); err != nil && strings.Contains(err.Error(), "failed to upsert new centroid") {
// first-posting creation failed at storage layer; check disk and retry
} Prevention
- Monitor storage health; this fires on the very first insert into an empty index
- Avoid dropping the index concurrently with imports
- Restore the shard from backup if the centroid store is corrupted
When it happens
Trigger: Inserting into an empty (or fully-deleted) HFresh index via Add/AddMulti where the centroid insert into the Centroids structure fails for the freshly allocated postingID.
Common situations: Underlying storage write failure (disk full, I/O error); ID generator (h.IDs.Next) succeeded but centroid store is corrupted or unavailable; concurrent index shutdown.
Related errors
- could not persist dimensions
- could not persist RQ data
- store muvera data in index metadata
- put muvera vector into bucket
- failed to get candidate centroid
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/a2ba099e4b1903b1.
Report an issue: GitHub.