{"record":{"id":"1b2e321bd29e4923","repo":"weaviate/weaviate","slug":"class-name-w","errorCode":null,"errorMessage":"class name: %w","messagePattern":"class name: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/storobj/storage_object.go","lineNumber":1941,"sourceCode":"}\n\n// skipToVectorSections walks the five length-prefixed fields between the fixed\n// header and the target-vector section.\nfunc skipToVectorSections(rw *byteops.ReadWriter) error {\n\tvectorLength, err := rw.ReadUint16Checked()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"vector length: %w\", err)\n\t}\n\tif err := rw.SkipChecked(uint64(vectorLength) * byteops.Uint32Len); err != nil {\n\t\treturn fmt.Errorf(\"vector: %w\", err)\n\t}\n\n\tclassNameLength, err := rw.ReadUint16Checked()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"class name length: %w\", err)\n\t}\n\tif err := rw.SkipChecked(uint64(classNameLength)); err != nil {\n\t\treturn fmt.Errorf(\"class name: %w\", err)\n\t}\n\n\tfor _, field := range []string{\"schema\", \"meta\", \"vector weights\"} {\n\t\tlength, err := rw.ReadUint32Checked()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s length: %w\", field, err)\n\t\t}\n\t\tif err := rw.SkipChecked(uint64(length)); err != nil {\n\t\t\treturn fmt.Errorf(\"%s: %w\", field, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc MultiVectorFromBinary(in []byte, targetVector string) ([][]float32, error) {\n\tif len(in) == 0 {\n\t\treturn nil, nil\n\t}","sourceCodeStart":1923,"sourceCodeEnd":1959,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/storobj/storage_object.go#L1923-L1959","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Treat the record as corrupt: re-index the object or restore from backup.","Sanity-check declared lengths against total object size before skipping (defensive pre-check in caller).","Verify no marshaller-version skew between the writer that produced these bytes and the current reader."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if len(raw) > 16+2 {\n    vecLen := int(binary.LittleEndian.Uint16(raw[16 : 16+2]))\n    p := 16 + 2 + vecLen*4\n    if p+2 > len(raw) {\n        return nil, fmt.Errorf(\"class name length prefix out of bounds\")\n    }\n    cnLen := int(binary.LittleEndian.Uint16(raw[p : p+2]))\n    if p+2+cnLen > len(raw) {\n        return nil, fmt.Errorf(\"class name truncated: need %d, have %d\", cnLen, len(raw)-p-2)\n    }\n}","typeGuard":null,"tryCatchPattern":"vec, err := storobj.VectorFromBinary(raw, buf, targetVector)\nif err != nil {\n    return nil, fmt.Errorf(\"corrupt record, needs re-index: %w\", err)\n}","preventionTips":["Sanity-check every declared length against remaining buffer size before skipping.","Treat isolated corrupt records by re-indexing that object only.","Watch for systematic corruption suggesting disk or version problems."],"tags":["go","storage","deserialization","corruption"],"backgroundTag":"truncated-record","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"}