weaviate/weaviate · error
element [%d]: %w
Error message
element [%d]: %w
What it means
Weaviate's auto-schema analyzes an incoming array-typed property value by determining the type of each element independently via determineArrayType. When any single element fails type determination, the error is wrapped with its index so the developer knows exactly which array element was the problem. It is thrown during object creation/update when auto-schema is enabled and a new or untyped property contains an array with an invalid element.
Source
Thrown at usecases/objects/auto_schema.go:299
}
if dt, ok := m.asPhoneNumber(typedValue); ok {
return dt, nil
}
}
return []schema.DataType{schema.DataTypeObject}, nil
case []interface{}:
if len(typedValue) == 0 {
return fallbackArrayDataType, nil
}
refDataTypes := []schema.DataType{}
var isRef bool
var determinedDataType schema.DataType
for i := range typedValue {
dataType, refDataType, err := m.determineArrayType(typedValue[i], ofNestedProp)
if err != nil {
return nil, fmt.Errorf("element [%d]: %w", i, err)
}
if i == 0 {
isRef = refDataType != ""
determinedDataType = dataType
}
if dataType != "" {
// if an array contains text and UUID/Date, the type should be text
if determinedDataType == schema.DataTypeTextArray && (dataType == schema.DataTypeUUIDArray || dataType == schema.DataTypeDateArray) {
continue
}
if determinedDataType == schema.DataTypeDateArray && (dataType == schema.DataTypeUUIDArray || dataType == schema.DataTypeTextArray) {
determinedDataType = schema.DataTypeTextArray
continue
}
if determinedDataType == schema.DataTypeUUIDArray && (dataType == schema.DataTypeDateArray || dataType == schema.DataTypeTextArray) {
determinedDataType = schema.DataTypeTextArray
continue
}View on GitHub (pinned to 75aa4b6d11)
Solutions
- Inspect the array element at the reported index and correct it to a supported scalar type (text, int, number, boolean, date, uuid, or a nested object map).
- Pre-validate property values client-side before posting so all array elements are homogeneous and of a known JSON type.
- If the property should be a specific type, define it explicitly in the collection schema instead of relying on auto-schema inference.
- Check the client/serialization layer for bugs that introduce nulls or nested arrays into the payload.
Example fix
// before (invalid nested array element)
{"properties": {"tags": [["a"], "b"]}}
// after
{"properties": {"tags": ["a", "b"]}} Defensive patterns
Strategy: validation
Validate before calling
func validArrayElement(v interface{}) bool {
switch v.(type) {
case string, int, int64, float64, bool, nil:
return v != nil
case map[string]interface{}:
return true
case []interface{}:
return false // nested arrays unsupported
default:
return false
}
}
for i, el := range arr {
if !validArrayElement(el) { return fmt.Errorf("element %d invalid", i) }
} Type guard
func isSupportedScalar(v interface{}) bool {
switch v.(type) {
case string, float64, bool:
return true
default:
return false
}
} Prevention
- Validate array payloads client-side before POSTing objects.
- Never send nulls or nested arrays inside property arrays.
- Keep array elements homogeneous in type.
- Define property dataTypes explicitly in the schema for critical collections.
When it happens
Trigger: POST /v1/objects (or batch objects) with auto-schema enabled, supplying a property whose value is an array where at least one element is not a recognized primitive (e.g. a nested array, a nil entry of unsupported type, or a map that matches no known object type). The failing index is reported in the message.
Common situations: Sending heterogeneous or malformed JSON arrays (e.g. [[1,2],[3,4]]), passing nulls inside arrays, or a client serializing values incorrectly (numbers as strings mixed with numbers). Also common when an embedding pipeline emits unexpected element types for text2vec inputs.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- element [%d]: mismatched data type - reference expected, got
- element [%d]: mismatched data type - '%s' expected, got '%s'
- element [%d]: mismatched data type - '%s' expected, got refe
- unrecognized data type of value '%v' - one of '%s' expected
- nested property '%s': %w
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/1658ec4486b374f4.
Report an issue: GitHub.