weaviate/weaviate · error

read vector weights: %w

Error message

read vector weights: %w

What it means

Thrown when ReadBytesFromBufferChecked(vectorWeightsLength) cannot read the declared number of vector-weight bytes from the buffer. The record is truncated inside the vector-weights region — the last variable-length region before target vectors. The wrapped error comes from the checked reader.

Source

Thrown at entities/storobj/storage_object.go:320

	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 {
				ko.Object.Vectors[vecName] = vec
			}
		}
	} else if err := skipVectorSegment(&rw, "target vectors"); err != nil {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Re-fetch the object from a healthy replica.
  2. Restore the shard from backup or rebuild the collection via reindex.
  3. Pin all nodes to the same Weaviate version.
  4. Add pre-call length validation at the deserialization call site.

Example fix

// before
obj, err := storobj.FromBinaryOptionalDisk(data)
return obj, err
// after
obj, err := storobj.FromBinaryOptionalDisk(data)
if err != nil {
    return nil, fmt.Errorf("unreadable stored object (possibly torn write): %w", err)
}
Defensive patterns

Strategy: fallback

Try / catch

obj, err := storobj.FromBinaryOptionalDisk(data)
if err != nil {
    // fall back to another replica or to schema-only metadata
    alt, altErr := fetchFromReplica(docID)
    if altErr != nil { return nil, fmt.Errorf("both replicas unreadable: %w; %v", err, altErr) }
    obj = alt
}

Prevention

When it happens

Trigger: FromBinaryOptionalNetwork/Disk on a record whose vectorWeightsLength exceeds remaining bytes. Happens with tail-truncated payloads or after a misparse shifted the cursor earlier in the record.

Common situations: Node crash mid-write leaving a torn record, network corruption between replicas during data transfer/repair, or format-version drift changing preceding field sizes.

Related errors


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