{"record":{"id":"cddc3fecc0899d91","repo":"weaviate/weaviate","slug":"parse-interface-as-multi-vector-for-target-vec-cddc3f","errorCode":null,"errorMessage":"parse []interface{} as multi vector for target vector: %s, unrecognized type: %T","messagePattern":"parse \\[\\]interface(.+?) as multi vector for target vector: (.+?), unrecognized type: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/dto/dto.go","lineNumber":140,"sourceCode":"\t\t\t\t\tmultiVectors = make(map[string][][]float32)\n\t\t\t\t}\n\t\t\t\tasMultiVectorArray := make([][]float32, len(vec))\n\t\t\t\tfor i := range vec {\n\t\t\t\t\tasMultiVectorArray[i] = make([]float32, len(vec[i]))\n\t\t\t\t\tfor j := range vec[i] {\n\t\t\t\t\t\tswitch v := vec[i][j].(type) {\n\t\t\t\t\t\tcase json.Number:\n\t\t\t\t\t\t\tasFloat, err := v.Float64()\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn nil, nil, fmt.Errorf(\"parse []interface{} as multi vector for target vector: %s: %w\", targetVector, err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tasMultiVectorArray[i][j] = float32(asFloat)\n\t\t\t\t\t\tcase float64:\n\t\t\t\t\t\t\tasMultiVectorArray[i][j] = float32(v)\n\t\t\t\t\t\tcase float32:\n\t\t\t\t\t\t\tasMultiVectorArray[i][j] = v\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn nil, nil, fmt.Errorf(\"parse []interface{} as multi vector for target vector: %s, unrecognized type: %T\", targetVector, vec[i])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmultiVectors[targetVector] = asMultiVectorArray\n\t\t\tcase []float32:\n\t\t\t\tif vectors == nil {\n\t\t\t\t\tvectors = make(map[string][]float32)\n\t\t\t\t}\n\t\t\t\tvectors[targetVector] = vec\n\t\t\tcase [][]float32:\n\t\t\t\tif multiVectors == nil {\n\t\t\t\t\tmultiVectors = make(map[string][][]float32)\n\t\t\t\t}\n\t\t\t\tmultiVectors[targetVector] = vec\n\t\t\tdefault:\n\t\t\t\treturn nil, nil, fmt.Errorf(\"unrecognized vector type: %T for target vector: %s\", vector, targetVector)\n\t\t\t}\n\t\t}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/dto/dto.go#L122-L158","documentation":"While flattening a [][]interface{} multi-vector into [][]float32, an inner element was neither json.Number, float64, nor float32 — e.g. a string, bool, null, or an extra level of nesting. The error reports the type of vec[i] (the offending inner value) and the targetVector name.","triggerScenarios":"Multi-vector payloads ([][]interface{}) submitted via BatchPutObjects or object create/update where an inner array contains quoted numbers, nulls, or a triple-nested array for a named targetVector.","commonSituations":"Clients confusing single-vector and multi-vector shapes (adding an extra nesting level); JSON with stringified numbers or missing values inside inner arrays.","solutions":["Ensure the payload is exactly two levels: array of arrays of numbers","Replace strings/bools/nulls with valid numbers in the inner arrays","Verify the collection's vector config matches multi-vector input; flatten to single vector if it is not"],"exampleFix":"// before\n{\"multi_vector\": [[\"0.1\", 0.2], [0.3]]}\n// after\n{\"multi_vector\": [[0.1, 0.2], [0.3]]}","handlingStrategy":"validation","validationCode":"func validMultiVectorShape(vec [][]interface{}) error {\n    for i, inner := range vec {\n        for j, e := range inner {\n            switch e.(type) {\n            case json.Number, float64, float32:\n            default:\n                return fmt.Errorf(\"[%d][%d] not a number: %T\", i, j, e)\n            }\n        }\n    }\n    return nil\n}","typeGuard":"func isFlatNumberMatrix(v interface{}) bool {\n    m, ok := v.([][]interface{})\n    if !ok { return false }\n    for _, inner := range m {\n        for _, e := range inner {\n            switch e.(type) {\n            case json.Number, float64, float32:\n            default:\n                return false\n            }\n        }\n    }\n    return true\n}","tryCatchPattern":"_, _, err := dto.GetVectors(in)\nif err != nil {\n    if strings.Contains(err.Error(), \"as multi vector\") && strings.Contains(err.Error(), \"unrecognized type\") {\n        return badRequest(\"multi-vector inner elements must be numbers\")\n    }\n    return err\n}","preventionTips":["Use exactly two nesting levels for multi-vectors — no deeper","Serialize multi-vectors as [][]float32 client-side to eliminate string/null leaks","Confirm the collection supports multi-vectors before sending nested arrays"],"tags":["go","json","vectors","type-mismatch","multi-vector"],"backgroundTag":"invalid-vector-payload","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"}