weaviate/weaviate · error
creating nested object array
Error message
creating nested object array
What it means
NewNestedValue handles DataTypeObjectArray by converting each element via newObjectList125. If any element fails conversion (e.g. an element of the array is not a valid nested object per the schema), the failure is wrapped as "creating nested object array".
Source
Thrown at adapters/handlers/grpc/v1/mapping.go:125
return m.NewNilValue(), nil
}
switch dt {
case schema.DataTypeObject:
if _, ok := v.(map[string]interface{}); !ok {
return nil, protoimpl.X.NewError("invalid type: %T expected map[string]interface{}", v)
}
obj, err := m.newObject(v.(map[string]interface{}), parent, prop)
if err != nil {
return nil, errors.Wrap(err, "creating nested object")
}
return NewObjectValue(obj), nil
case schema.DataTypeObjectArray:
if _, ok := v.([]interface{}); !ok {
return nil, protoimpl.X.NewError("invalid type: %T expected []map[string]interface{}", v)
}
list, err := m.newObjectList125(v.([]interface{}), parent, prop)
if err != nil {
return nil, errors.Wrap(err, "creating nested object array")
}
return newListValue(list), nil
default:
return nil, protoimpl.X.NewError("invalid type: %T", v)
}
}
// NewObject constructs a Object from a general-purpose Go map.
// The map keys must be valid UTF-8.
// The map values are converted using NewValue.
func (m *Mapper) newObject(v map[string]interface{}, parent schema.PropertyInterface, selectProp search.SelectProperty) (*pb.Properties, error) {
if !selectProp.IsObject {
return nil, errors.New("select property is not an object")
}
x := &pb.Properties{Fields: make(map[string]*pb.Value, len(v))}
for _, selectProp := range selectProp.Props {
val, ok := v[selectProp.Name]
if !ok {View on GitHub (pinned to 75aa4b6d11)
Solutions
- Ensure every array element is an object whose fields match the nested schema
- Flatten invalid deeper nesting (arrays of arrays are not supported)
- Validate one element offline against the schema before batch sending
- Update client SDK to a version matching the server's schema handling
Example fix
// before: element is not an object
{"tags": ["a", "b"]} // schema declares tags as DataTypeObjectArray
// after: each element must be an object
{"tags": [{"name": "a"}, {"name": "b"}]} Defensive patterns
Strategy: validation
Validate before calling
// every element must be a valid object per schema
arr, ok := value.([]interface{})
if !ok { return errors.New("expected object array") }
for i, el := range arr {
if _, ok := el.(map[string]interface{}); !ok {
return fmt.Errorf("element %d is not an object", i)
}
} Type guard
func isObjectArray(v interface{}) bool {
arr, ok := v.([]interface{})
if !ok { return false }
for _, el := range arr {
if _, ok := el.(map[string]interface{}); !ok { return false }
}
return true
} Try / catch
list, err := mapper.NewNestedValue(val, dt, nested, selectProp)
if err != nil {
return nil, fmt.Errorf("array property %q: %w", selectProp.Name, err)
} Prevention
- Never nest arrays directly inside object arrays
- Validate each array element's shape against the nested schema
- Keep batch payloads homogeneous in element structure
When it happens
Trigger: Client sends an object-array property where at least one array element contains a field of the wrong type or an invalid nested structure relative to the schema.
Common situations: Batch imports with mixed-shape arrays, clients sending nested arrays where the schema expects an array of objects (no deeper nesting), SDK serialization bugs.
Related errors
- target is a multi-target reference, need single target %v
- target is a single-target reference, need multi-target %v
- extract filters: %w
- creating nested object
- creating nested object value %s
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/2f73ed9c86d51bf2.
Report an issue: GitHub.