weaviate/weaviate · error

Getting vector for id

Error message

Getting vector for id

What it means

This error wraps a lower-level lsmkv bucket read failure that occurred while fetching a compressed (quantized) vector for a given internal document id. The quantized-vectors compressor looks up the vector bytes in the compressed-vector bucket; if the bucket backend returns any error (I/O failure, corrupt segment, closed segment handle), it is wrapped with this message so the caller knows the failure was during vector retrieval, not the fallback path.

Source

Thrown at adapters/repos/db/vector/compressionhelpers/compression.go:284

	compressedVector2, err := compressor.compressedVectorFromID(ctx, id2)
	if err != nil {
		return 0, err
	}

	dist, err := compressor.DistanceBetweenCompressedVectors(compressedVector1, compressedVector2)
	return dist, err
}

func (compressor *quantizedVectorsCompressor[T]) getCompressedVectorForID(ctx context.Context, id uint64) ([]T, error) {
	idBytes := make([]byte, 8)
	compressor.storeId(idBytes, id)
	bucket := compressor.compressedBucket()
	if bucket == nil {
		return nil, lsmkv.ErrAlreadyClosed
	}
	compressedVector, err := bucket.Get(idBytes)
	if err != nil {
		return nil, errors.Wrap(err, "Getting vector for id")
	}
	if len(compressedVector) == 0 {
		if compressor.vectorForID != nil {
			return compressor.recoverCompressedVector(ctx, id, idBytes, bucket)
		}
		return nil, storobj.NewErrNotFoundf(id, "getCompressedVectorForID")
	}

	return compressor.quantizer.FromCompressedBytes(compressedVector), nil
}

// recoverCompressedVector fetches the raw vector, encodes it, and persists
// it to the compressed bucket so future reads don't need recovery.
// Write-back is a cache-fill optimization: if the bucket is read-only (e.g.
// shard temporarily READONLY during UpdateVectorIndexConfigs, resource
// pressure, or backup), the persist is skipped and the encoded vector is
// returned. A future read will re-encode if the bucket is still empty for
// this id, which is acceptable for this rare path.

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check shard logs just before this error for lsmkv compaction/segment errors to identify the failing segment file
  2. Verify disk health and free space on the data volume; repair or replace failing storage
  3. Stop writes, restart the node to reopen buckets cleanly; if corruption persists, restore the shard from backup or recalculate vectors by dropping and re-creating the quantization (re-vectorize from the original vector index or re-import)
  4. If it recurs on a specific shard, delete that shard's compressed bucket directory and let the compressor rebuild it from the primary vector index

Example fix

// before: raw lsmkv error surfaces with no shard context
compressedVector, err := bucket.Get(idBytes)
// after: wrap with action logging so operators can locate the failing shard
compressedVector, err := bucket.Get(idBytes)
if err != nil {
	compressor.logger.WithField("action", "getCompressedVectorForID").Warnf("getting vector for id %d: %v", id, err)
	return nil, errors.Wrap(err, "Getting vector for id")
}
Defensive patterns

Strategy: try-catch

Type guard

func isBucketClosedErr(err error) bool { return errors.Is(err, lsmkv.ErrAlreadyClosed) }

Try / catch

v, err := compressor.getCompressedVectorForID(ctx, id)
if err != nil {
	if errors.Is(err, storobj.ErrNotFound) {
		// object genuinely absent
		return nil
	}
	return fmt.Errorf("compressed vector fetch failed: %w", err)
}

Prevention

When it happens

Trigger: Calling getCompressedVectorForID (directly or via vector retrieval during search/reindex) when the underlying lsmkv compressed bucket's Get fails — e.g. disk I/O error, corrupted segment file, or a race with bucket shutdown where the bucket is partially closed.

Common situations: Disk full or failing disk on a shard directory; LSM segment corruption after an unclean shutdown; concurrent shard drop/compaction racing a query; read-only filesystem during recovery attempts.

Related errors


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