weaviate/weaviate · error

read vector weights length: %w

Error message

read vector weights length: %w

What it means

Returned when reading the uint32 vector-weights length field fails because the buffer is exhausted at that point. The field follows the meta region; hitting this error means the record ends before it. It is a checked-reader guard against parsing beyond the payload.

Source

Thrown at entities/storobj/storage_object.go:316

		return nil, fmt.Errorf("read properties: %w", err)
	}

	metaLength, err := rw.ReadUint32Checked()
	if err != nil {
		return nil, fmt.Errorf("read meta length: %w", err)
	}
	var meta []byte
	if addProp.Classification || len(addProp.ModuleParams) > 0 {
		if meta, err = rw.ReadBytesFromBufferChecked(uint64(metaLength)); err != nil {
			return nil, fmt.Errorf("read meta: %w", err)
		}
	} else if err := rw.SkipChecked(uint64(metaLength)); err != nil {
		return nil, fmt.Errorf("skip meta: %w", err)
	}

	vectorWeightsLength, err := rw.ReadUint32Checked()
	if err != nil {
		return nil, fmt.Errorf("read vector weights length: %w", err)
	}
	vectorWeights, err := rw.ReadBytesFromBufferChecked(uint64(vectorWeightsLength))
	if err != nil {
		return nil, fmt.Errorf("read vector weights: %w", err)
	}

	if len(addProp.Vectors) > 0 {
		vectors, err := unmarshalTargetVectors(&rw)
		if err != nil {
			return nil, err
		}
		ko.Vectors = vectors

		if vectors != nil {
			// If parseObject is called, ko.Object will be overwritten making this effectively a
			// no-op, but I'm leaving it here for now to avoid breaking anything.
			ko.Object.Vectors = make(models.Vectors)
			for vecName, vec := range vectors {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify identical Weaviate versions/format on both ends of the transfer.
  2. Restore corrupted segments from backup or reindex the collection.
  3. Check the caller passes the full, intact record bytes.
  4. Log the record bytes for offline analysis if corruption recurs.

Example fix

// before
obj, err := storobj.FromBinaryOptionalNetwork(ctx, b, addProp)
// after
if got, want := len(b), minLen; got < want {
    return fmt.Errorf("payload %d < minimum %d", got, want)
}
obj, err := storobj.FromBinaryOptionalNetwork(ctx, b, addProp)
Defensive patterns

Strategy: validation

Validate before calling

if len(b) == 0 { return errors.New("empty record") }
obj, err := storobj.FromBinaryOptionalDisk(b)

Try / catch

obj, err := storobj.FromBinaryOptionalDisk(b)
if err != nil {
    return nil, fmt.Errorf("unreadable record (vector weights length): %w", err)
}

Prevention

When it happens

Trigger: FromBinaryOptionalNetwork/Disk on records truncated before the vector-weights length, e.g. buffer ending inside or right after the meta region. Also from cursor misalignment due to earlier misparsed lengths.

Common situations: Cross-version deserialization where preceding field layouts differ, damaged LSM segments, or incomplete replication payloads.

Related errors


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