weaviate/weaviate · error
read class name length: %w
Error message
read class name length: %w
What it means
Raised by fromBinaryOptionalInternal in entities/storobj/storage_object.go:273 when rw.ReadUint16Checked() fails reading the on-disk class-name length field — the buffer ends before the uint16 can be read. This check happens after the vector section, so failing here indicates truncation of the payload past the vector region. Note: if className is supplied non-empty (Disk variant), a corrupt length still aborts decode even though the value would have been skipped.
Source
Thrown at entities/storobj/storage_object.go:273
}
ko.Object.Vector = make([]float32, vectorLength)
byteops.CopyBytesToSlice(ko.Object.Vector, vectorBytes)
} else {
if err := rw.SkipChecked(vectorByteLen); err != nil {
return nil, fmt.Errorf("skip vector: %w", err)
}
ko.Object.Vector = nil
}
ko.Vector = ko.Object.Vector
// className precedence: a non-empty caller-supplied className wins and
// the on-disk class-name bytes are skipped. An empty caller className
// falls back to the on-disk value. If both are empty there is no class
// to attach to the decoded object — return an error rather than produce
// a silent empty Class.
classNameLength, err := rw.ReadUint16Checked()
if err != nil {
return nil, fmt.Errorf("read class name length: %w", err)
}
if className == "" {
if classNameLength == 0 {
return nil, errors.New("storobj: cannot decode object with empty className: caller supplied no className and on-disk class-name field is empty")
}
classNameBytes, err := rw.ReadBytesFromBufferChecked(uint64(classNameLength))
if err != nil {
return nil, fmt.Errorf("read class name: %w", err)
}
className = string(classNameBytes)
} else if err := rw.SkipChecked(uint64(classNameLength)); err != nil {
return nil, fmt.Errorf("skip class name: %w", err)
}
propLength, err := rw.ReadUint32Checked()
if err != nil {
return nil, fmt.Errorf("read properties length: %w", err)
}View on GitHub (pinned to 75aa4b6d11)
Solutions
- Re-fetch the object; if persistent, restore from backup or a healthy replica.
- Verify the payload slice is complete and starts at the object boundary (no offset misalignment).
- Confirm marshaller version byte is 1 on both writer and reader.
- If widespread across objects, check segment-file integrity for the shard.
Defensive patterns
Strategy: try-catch
Try / catch
obj, err := storobj.FromBinaryOptionalDisk(data, className, addProps, extraction)
if err != nil {
logger.Warnf("decode of %s failed past vector section: %v", className, err)
return nil
} Prevention
- Pass complete payloads — the class-name length sits after vectors, so truncation anywhere breaks decode
- Supply className via FromBinaryOptionalDisk when known (does not avoid this error but simplifies handling)
- Check segment integrity when errors cluster on one shard
- Restore truncated objects from backups
When it happens
Trigger: FromBinaryOptionalNetwork / FromBinaryOptionalDisk called with a payload that ends immediately after the vector section, so the uint16 class-name length cannot be read.
Common situations: Truncated network transfer or disk read; corrupted LSM value cut between the vector and class-name fields; caller passing a wrong-format or partially sliced blob.
Related errors
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/205ee0495638ab7b.
Report an issue: GitHub.