weaviate/weaviate · error

invalid object '%d' in array: %w

Error message

invalid object '%d' in array: %w

What it means

While validating elements of an object[] property, element %d failed nested-object validation. This wrapper adds the array index to the wrapped objectVal error so the offending element in a long array can be identified.

Source

Thrown at usecases/objects/validation/properties_validation.go:243

		}
		typed[nestedKey] = data
	}

	return typed, nil
}

func objectArrayVal(ctx context.Context, v *Validator, val interface{}, propertyPrefix string,
	className string, nestedPropertiesMap map[string]*models.NestedProperty,
) (interface{}, error) {
	typed, ok := val.([]interface{})
	if !ok {
		return nil, fmt.Errorf("not an object array, but %T", val)
	}

	for i := range typed {
		data, err := objectVal(ctx, v, typed[i], propertyPrefix, className, nestedPropertiesMap)
		if err != nil {
			return nil, fmt.Errorf("invalid object '%d' in array: %w", i, err)
		}
		typed[i] = data
	}

	return typed, nil
}

func (v *Validator) extractAndValidateProperty(ctx context.Context, propertyName string, pv interface{},
	className string, dataType *schema.DataType, tenant string,
) (interface{}, error) {
	var (
		data interface{}
		err  error
	)

	switch *dataType {
	case schema.DataTypeCRef:
		data, err = v.cRef(ctx, propertyName, pv, className, tenant)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Use the reported index to find the exact element, then fix per the wrapped error (type mismatch, unknown key, etc.).
  2. Validate array elements client-side before batch writes.
  3. Remove null/malformed elements from object arrays.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at usecases/objects/validation/properties_validation.go:243 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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