{"record":{"id":"794d99611334f22a","repo":"weaviate/weaviate","slug":"unmarshal-property-bytes-size-d","errorCode":null,"errorMessage":"unmarshal property bytes: size %d","messagePattern":"unmarshal property bytes: size (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/storobj/storage_object.go","lineNumber":1993,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal multivector for target vector %q: %w\", targetVector, err)\n\t}\n\n\tout, ok := multiVectors[targetVector]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"vector not found for target vector: %s\", targetVector)\n\t}\n\treturn out, nil\n}\n\nfunc (ko *Object) parseObject(uuid strfmt.UUID, create, update int64, className string,\n\tpropsB []byte, additionalB []byte, vectorWeightsB []byte, properties *PropertyExtraction, propLength uint32,\n) error {\n\tvar returnProps map[string]interface{}\n\tif len(propsB) > 0 {\n\t\tif properties == nil || propLength == 0 {\n\t\t\tif err := json.Unmarshal(propsB, &returnProps); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"unmarshal property bytes: size %d\", len(propsB))\n\t\t\t}\n\t\t} else if len(propsB) >= int(propLength) {\n\t\t\t// the properties are not read in all cases, skip if not needed\n\t\t\treturnProps = make(map[string]interface{}, len(properties.PropertyPaths))\n\t\t\tif err := UnmarshalProperties(propsB[:propLength], returnProps, properties.PropertyPaths); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"unmarshal property bytes: size %d and property length %d\", len(propsB), int(propLength))\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := enrichSchemaTypes(returnProps, false); err != nil {\n\t\treturn errors.Wrap(err, \"enrich schema datatypes\")\n\t}\n\n\tvar additionalProperties models.AdditionalProperties\n\tif len(additionalB) > 0 {\n\t\tif err := json.Unmarshal(additionalB, &additionalProperties); err != nil {\n\t\t\treturn err","sourceCodeStart":1975,"sourceCodeEnd":2011,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/storobj/storage_object.go#L1975-L2011","documentation":"Wraps a json.Unmarshal failure that occurs when decoding the property blob of a persisted StorageObject back into a map. The library throws it when the compact per-property decode path cannot be used (no PropertyExtraction hints or zero propLength) and the full JSON decode of propsB fails, meaning the stored property bytes are corrupt, truncated, or not the expected JSON object.","triggerScenarios":"Calling StorageObject parsing (e.g. fromPropertiesBytes/fromParsed) with a non-empty propsB slice whose contents fail strict JSON decoding — corrupted on-disk segment data, hand-edited or truncated object files, or bytes produced by a different serialization version.","commonSituations":"Reading objects from a damaged or partially written LSM segment after a crash, copying segment files between nodes with incompatible versions, or manual tooling that rewrites storage objects.","solutions":["Verify the segment/store files are not corrupted by restoring from backup or resyncing from another replica","Check that the writer and reader use compatible Weaviate versions (serialization format changes between versions)","Re-ingest the affected objects so the property bytes are rewritten","If building custom tooling, confirm propsB is valid JSON of an object ({...}) before decoding"],"exampleFix":"// before\nvar m map[string]interface{}\njson.Unmarshal(rawProps, &m) // panics/ignores error downstream\n// after\nif err := json.Unmarshal(rawProps, &m); err != nil {\n    return fmt.Errorf(\"unmarshal property bytes: size %d: %w\", len(rawProps), err)\n}","handlingStrategy":"validation","validationCode":"func validProps(b []byte) bool {\n    var m map[string]json.RawMessage\n    return len(b) > 0 && json.Unmarshal(b, &m) == nil\n}","typeGuard":"func isJSONObject(b []byte) bool {\n    var v interface{}\n    return json.Unmarshal(b, &v) == nil\n}","tryCatchPattern":"if err := json.Unmarshal(propsB, &m); err != nil {\n    return fmt.Errorf(\"corrupt property bytes (len=%d): %w\", len(propsB), err)\n}","preventionTips":["Never hand-edit or truncate LSM segment files","Keep reader and writer Weaviate versions in sync","Restore corrupted shards from backup or replicas","Validate restored data files after any storage migration"],"tags":["json","deserialization","storage"],"backgroundTag":"json-unmarshal-failed","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"}