{"record":{"id":"205ee0495638ab7b","repo":"weaviate/weaviate","slug":"read-class-name-length-w","errorCode":null,"errorMessage":"read class name length: %w","messagePattern":"read class name length: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/storobj/storage_object.go","lineNumber":273,"sourceCode":"\t\t}\n\t\tko.Object.Vector = make([]float32, vectorLength)\n\t\tbyteops.CopyBytesToSlice(ko.Object.Vector, vectorBytes)\n\t} else {\n\t\tif err := rw.SkipChecked(vectorByteLen); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"skip vector: %w\", err)\n\t\t}\n\t\tko.Object.Vector = nil\n\t}\n\tko.Vector = ko.Object.Vector\n\n\t// className precedence: a non-empty caller-supplied className wins and\n\t// the on-disk class-name bytes are skipped. An empty caller className\n\t// falls back to the on-disk value. If both are empty there is no class\n\t// to attach to the decoded object — return an error rather than produce\n\t// a silent empty Class.\n\tclassNameLength, err := rw.ReadUint16Checked()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read class name length: %w\", err)\n\t}\n\tif className == \"\" {\n\t\tif classNameLength == 0 {\n\t\t\treturn nil, errors.New(\"storobj: cannot decode object with empty className: caller supplied no className and on-disk class-name field is empty\")\n\t\t}\n\t\tclassNameBytes, err := rw.ReadBytesFromBufferChecked(uint64(classNameLength))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"read class name: %w\", err)\n\t\t}\n\t\tclassName = string(classNameBytes)\n\t} else if err := rw.SkipChecked(uint64(classNameLength)); err != nil {\n\t\treturn nil, fmt.Errorf(\"skip class name: %w\", err)\n\t}\n\n\tpropLength, err := rw.ReadUint32Checked()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read properties length: %w\", err)\n\t}","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/storobj/storage_object.go#L255-L291","documentation":"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.","triggerScenarios":"FromBinaryOptionalNetwork / FromBinaryOptionalDisk called with a payload that ends immediately after the vector section, so the uint16 class-name length cannot be read.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"obj, err := storobj.FromBinaryOptionalDisk(data, className, addProps, extraction)\nif err != nil {\n    logger.Warnf(\"decode of %s failed past vector section: %v\", className, err)\n    return nil\n}","preventionTips":["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"],"tags":["deserialization","truncated","class-name","storage"],"backgroundTag":"truncated-binary-payload","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}