weaviate/weaviate · error

class name: %w

Error message

class name: %w

What it means

skipToVectorSections read a class-name length and then tried to skip that many bytes; SkipChecked failed because the remaining buffer is shorter than the declared class name. The object is truncated inside (or the class-name length prefix is corrupt).

Source

Thrown at entities/storobj/storage_object.go:1941

}

// skipToVectorSections walks the five length-prefixed fields between the fixed
// header and the target-vector section.
func skipToVectorSections(rw *byteops.ReadWriter) error {
	vectorLength, err := rw.ReadUint16Checked()
	if err != nil {
		return fmt.Errorf("vector length: %w", err)
	}
	if err := rw.SkipChecked(uint64(vectorLength) * byteops.Uint32Len); err != nil {
		return fmt.Errorf("vector: %w", err)
	}

	classNameLength, err := rw.ReadUint16Checked()
	if err != nil {
		return fmt.Errorf("class name length: %w", err)
	}
	if err := rw.SkipChecked(uint64(classNameLength)); err != nil {
		return fmt.Errorf("class name: %w", err)
	}

	for _, field := range []string{"schema", "meta", "vector weights"} {
		length, err := rw.ReadUint32Checked()
		if err != nil {
			return fmt.Errorf("%s length: %w", field, err)
		}
		if err := rw.SkipChecked(uint64(length)); err != nil {
			return fmt.Errorf("%s: %w", field, err)
		}
	}
	return nil
}

func MultiVectorFromBinary(in []byte, targetVector string) ([][]float32, error) {
	if len(in) == 0 {
		return nil, nil
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Treat the record as corrupt: re-index the object or restore from backup.
  2. Sanity-check declared lengths against total object size before skipping (defensive pre-check in caller).
  3. Verify no marshaller-version skew between the writer that produced these bytes and the current reader.
Defensive patterns

Strategy: validation

Validate before calling

if len(raw) > 16+2 {
    vecLen := int(binary.LittleEndian.Uint16(raw[16 : 16+2]))
    p := 16 + 2 + vecLen*4
    if p+2 > len(raw) {
        return nil, fmt.Errorf("class name length prefix out of bounds")
    }
    cnLen := int(binary.LittleEndian.Uint16(raw[p : p+2]))
    if p+2+cnLen > len(raw) {
        return nil, fmt.Errorf("class name truncated: need %d, have %d", cnLen, len(raw)-p-2)
    }
}

Try / catch

vec, err := storobj.VectorFromBinary(raw, buf, targetVector)
if err != nil {
    return nil, fmt.Errorf("corrupt record, needs re-index: %w", err)
}

Prevention

When it happens

Trigger: Parsing a v1 object where the uint16 class-name length exceeds the bytes remaining after it — corrupted length prefix or a record cut short mid-class-name.

Common situations: Bit-rot or partial writes on disk; reading a foreign/stale format where the length field means something else; test fixtures with hand-built byte arrays.

Related errors


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