weaviate/weaviate · error

unmarshal property bytes: size %d

Error message

unmarshal property bytes: size %d

What it means

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.

Source

Thrown at entities/storobj/storage_object.go:1993

	if err != nil {
		return nil, fmt.Errorf("unmarshal multivector for target vector %q: %w", targetVector, err)
	}

	out, ok := multiVectors[targetVector]
	if !ok {
		return nil, errors.Errorf("vector not found for target vector: %s", targetVector)
	}
	return out, nil
}

func (ko *Object) parseObject(uuid strfmt.UUID, create, update int64, className string,
	propsB []byte, additionalB []byte, vectorWeightsB []byte, properties *PropertyExtraction, propLength uint32,
) error {
	var returnProps map[string]interface{}
	if len(propsB) > 0 {
		if properties == nil || propLength == 0 {
			if err := json.Unmarshal(propsB, &returnProps); err != nil {
				return errors.Wrapf(err, "unmarshal property bytes: size %d", len(propsB))
			}
		} else if len(propsB) >= int(propLength) {
			// the properties are not read in all cases, skip if not needed
			returnProps = make(map[string]interface{}, len(properties.PropertyPaths))
			if err := UnmarshalProperties(propsB[:propLength], returnProps, properties.PropertyPaths); err != nil {
				return errors.Wrapf(err, "unmarshal property bytes: size %d and property length %d", len(propsB), int(propLength))
			}
		}
	}

	if err := enrichSchemaTypes(returnProps, false); err != nil {
		return errors.Wrap(err, "enrich schema datatypes")
	}

	var additionalProperties models.AdditionalProperties
	if len(additionalB) > 0 {
		if err := json.Unmarshal(additionalB, &additionalProperties); err != nil {
			return err

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify the segment/store files are not corrupted by restoring from backup or resyncing from another replica
  2. Check that the writer and reader use compatible Weaviate versions (serialization format changes between versions)
  3. Re-ingest the affected objects so the property bytes are rewritten
  4. If building custom tooling, confirm propsB is valid JSON of an object ({...}) before decoding

Example fix

// before
var m map[string]interface{}
json.Unmarshal(rawProps, &m) // panics/ignores error downstream
// after
if err := json.Unmarshal(rawProps, &m); err != nil {
    return fmt.Errorf("unmarshal property bytes: size %d: %w", len(rawProps), err)
}
Defensive patterns

Strategy: validation

Validate before calling

func validProps(b []byte) bool {
    var m map[string]json.RawMessage
    return len(b) > 0 && json.Unmarshal(b, &m) == nil
}

Type guard

func isJSONObject(b []byte) bool {
    var v interface{}
    return json.Unmarshal(b, &v) == nil
}

Try / catch

if err := json.Unmarshal(propsB, &m); err != nil {
    return fmt.Errorf("corrupt property bytes (len=%d): %w", len(propsB), err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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