{"record":{"id":"2e15586ae6ddf6e6","repo":"weaviate/weaviate","slug":"read-vector-weights-w","errorCode":null,"errorMessage":"read vector weights: %w","messagePattern":"read vector weights: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/storobj/storage_object.go","lineNumber":320,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read meta length: %w\", err)\n\t}\n\tvar meta []byte\n\tif addProp.Classification || len(addProp.ModuleParams) > 0 {\n\t\tif meta, err = rw.ReadBytesFromBufferChecked(uint64(metaLength)); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"read meta: %w\", err)\n\t\t}\n\t} else if err := rw.SkipChecked(uint64(metaLength)); err != nil {\n\t\treturn nil, fmt.Errorf(\"skip meta: %w\", err)\n\t}\n\n\tvectorWeightsLength, err := rw.ReadUint32Checked()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read vector weights length: %w\", err)\n\t}\n\tvectorWeights, err := rw.ReadBytesFromBufferChecked(uint64(vectorWeightsLength))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read vector weights: %w\", err)\n\t}\n\n\tif len(addProp.Vectors) > 0 {\n\t\tvectors, err := unmarshalTargetVectors(&rw)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tko.Vectors = vectors\n\n\t\tif vectors != nil {\n\t\t\t// If parseObject is called, ko.Object will be overwritten making this effectively a\n\t\t\t// no-op, but I'm leaving it here for now to avoid breaking anything.\n\t\t\tko.Object.Vectors = make(models.Vectors)\n\t\t\tfor vecName, vec := range vectors {\n\t\t\t\tko.Object.Vectors[vecName] = vec\n\t\t\t}\n\t\t}\n\t} else if err := skipVectorSegment(&rw, \"target vectors\"); err != nil {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/storobj/storage_object.go#L302-L338","documentation":"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.","triggerScenarios":"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.","commonSituations":"Node crash mid-write leaving a torn record, network corruption between replicas during data transfer/repair, or format-version drift changing preceding field sizes.","solutions":["Re-fetch the object from a healthy replica.","Restore the shard from backup or rebuild the collection via reindex.","Pin all nodes to the same Weaviate version.","Add pre-call length validation at the deserialization call site."],"exampleFix":"// before\nobj, err := storobj.FromBinaryOptionalDisk(data)\nreturn obj, err\n// after\nobj, err := storobj.FromBinaryOptionalDisk(data)\nif err != nil {\n    return nil, fmt.Errorf(\"unreadable stored object (possibly torn write): %w\", err)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"obj, err := storobj.FromBinaryOptionalDisk(data)\nif err != nil {\n    // fall back to another replica or to schema-only metadata\n    alt, altErr := fetchFromReplica(docID)\n    if altErr != nil { return nil, fmt.Errorf(\"both replicas unreadable: %w; %v\", err, altErr) }\n    obj = alt\n}","preventionTips":["Use replication factor > 1 so truncated records have healthy copies","Run backup-restore verification regularly","Investigate torn writes after crash-recovery events"],"tags":["serialization","storage","vectors","corruption"],"backgroundTag":"buffer-underflow-deserialization","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"}