{"record":{"id":"1658ec4486b374f4","repo":"weaviate/weaviate","slug":"element-d-w","errorCode":null,"errorMessage":"element [%d]: %w","messagePattern":"element \\[(.+?)\\]: %w","errorType":"validation","errorClass":null,"httpStatus":422,"severity":"error","filePath":"usecases/objects/auto_schema.go","lineNumber":299,"sourceCode":"\t\t\t}\n\t\t\tif dt, ok := m.asPhoneNumber(typedValue); ok {\n\t\t\t\treturn dt, nil\n\t\t\t}\n\t\t}\n\t\treturn []schema.DataType{schema.DataTypeObject}, nil\n\tcase []interface{}:\n\t\tif len(typedValue) == 0 {\n\t\t\treturn fallbackArrayDataType, nil\n\t\t}\n\n\t\trefDataTypes := []schema.DataType{}\n\t\tvar isRef bool\n\t\tvar determinedDataType schema.DataType\n\n\t\tfor i := range typedValue {\n\t\t\tdataType, refDataType, err := m.determineArrayType(typedValue[i], ofNestedProp)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"element [%d]: %w\", i, err)\n\t\t\t}\n\t\t\tif i == 0 {\n\t\t\t\tisRef = refDataType != \"\"\n\t\t\t\tdeterminedDataType = dataType\n\t\t\t}\n\t\t\tif dataType != \"\" {\n\t\t\t\t// if an array contains text and UUID/Date, the type should be text\n\t\t\t\tif determinedDataType == schema.DataTypeTextArray && (dataType == schema.DataTypeUUIDArray || dataType == schema.DataTypeDateArray) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif determinedDataType == schema.DataTypeDateArray && (dataType == schema.DataTypeUUIDArray || dataType == schema.DataTypeTextArray) {\n\t\t\t\t\tdeterminedDataType = schema.DataTypeTextArray\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif determinedDataType == schema.DataTypeUUIDArray && (dataType == schema.DataTypeDateArray || dataType == schema.DataTypeTextArray) {\n\t\t\t\t\tdeterminedDataType = schema.DataTypeTextArray\n\t\t\t\t\tcontinue\n\t\t\t\t}","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/auto_schema.go#L281-L317","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (invalid nested array element)\n{\"properties\": {\"tags\": [[\"a\"], \"b\"]}}\n// after\n{\"properties\": {\"tags\": [\"a\", \"b\"]}}","handlingStrategy":"validation","validationCode":"func validArrayElement(v interface{}) bool {\n\tswitch v.(type) {\n\tcase string, int, int64, float64, bool, nil:\n\t\treturn v != nil\n\tcase map[string]interface{}:\n\t\treturn true\n\tcase []interface{}:\n\t\treturn false // nested arrays unsupported\n\tdefault:\n\t\treturn false\n\t}\n}\nfor i, el := range arr {\n\tif !validArrayElement(el) { return fmt.Errorf(\"element %d invalid\", i) }\n}","typeGuard":"func isSupportedScalar(v interface{}) bool {\n\tswitch v.(type) {\n\tcase string, float64, bool:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["auto-schema","type-inference","arrays","weaviate"],"backgroundTag":"schema-validation-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"}