{"record":{"id":"cb8e939bd7fe5018","repo":"weaviate/weaviate","slug":"multiple-multi-vectors-found-specify-target-vecto","errorCode":null,"errorMessage":"multiple multi vectors found, specify target vector","messagePattern":"multiple multi vectors found, specify target vector","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/traverser/near_params_vector.go","lineNumber":438,"sourceCode":"\tswitch len(res) {\n\tcase 0:\n\t\treturn nil, \"\", errors.New(\"multi vector not found\")\n\tcase 1:\n\t\tif targetVector != \"\" {\n\t\t\tif len(res[0].Vectors) == 0 || res[0].Vectors[targetVector] == nil {\n\t\t\t\treturn nil, \"\", fmt.Errorf(\"multi vector not found for target: %v\", targetVector)\n\t\t\t}\n\t\t} else {\n\t\t\tif len(res[0].Vectors) == 1 {\n\t\t\t\tfor key, vec := range res[0].Vectors {\n\t\t\t\t\tv, ok := vec.([][]float32)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, \"\", fmt.Errorf(\"unrecognized multi vector type: %T\", vec)\n\t\t\t\t\t}\n\t\t\t\t\treturn v, key, nil\n\t\t\t\t}\n\t\t\t} else if len(res[0].Vectors) > 1 {\n\t\t\t\treturn nil, \"\", errors.New(\"multiple multi vectors found, specify target vector\")\n\t\t\t}\n\t\t}\n\t\treturn nil, \"\", fmt.Errorf(\"multi vector not found for target: %v\", targetVector)\n\tdefault:\n\t\treturn nil, \"\", fmt.Errorf(\"multiple multi vectors with incompatible dimensions found for target: %s\", targetVector)\n\t}\n}\n\nfunc (v *nearParamsVector) crossClassVectorFromNearObjectParams(ctx context.Context,\n\tparams *searchparams.NearObject,\n) (models.Vector, string, error) {\n\treturn v.vectorFromNearObjectParams(ctx, \"\", params, \"\", \"\")\n}\n\nfunc (v *nearParamsVector) vectorFromNearObjectParams(ctx context.Context,\n\tclassName string, params *searchparams.NearObject, tenant, targetVector string,\n) (models.Vector, string, error) {\n\tif len(params.ID) == 0 && len(params.Beacon) == 0 {","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/traverser/near_params_vector.go#L420-L456","documentation":"Thrown when the single object referenced by a nearObject search has more than one named vector and no targetVector was specified. With multiple vectors on one object the library cannot know which vector space to compute distances in, so it refuses to guess and asks the caller to disambiguate.","triggerScenarios":"A collection configured with multiple named vectors (multi-vector / named vectors feature) where the referenced object's res[0].Vectors map has len > 1, and the nearObject/nearVector query omits targetVector. Also the generic fallback at :438 when the target vector name given does not match any named vector on the object.","commonSituations":"Collections migrated to named vectors (e.g. adding a second vectorizer) while old client queries were written for single-vector schema; typo in the targetVector name so it resolves as empty/unmatched; GraphQL queries generated before the schema change.","solutions":["Add targetVector: \"<name>\" to the nearObject/nearVector clause, naming one of the collection's configured named vectors.","Check which named vectors exist on the class (schema) and use exactly one of those names.","Update client queries/templates that predate the multi-vector migration.","If a targetVector was passed, fix its spelling/casing to match the configured vector name."],"exampleFix":"// before\n{ Get { Product (nearObject: {id: \"6ba7b810-...\"}) { name } } }\n// after\n{ Get { Product (nearObject: {id: \"6ba7b810-...\", targetVector: \"title_vector\"}) { name } } }","handlingStrategy":"validation","validationCode":"// before issuing a nearObject query on a named-vector class:\nschema, _ := client.Schema().Getter().GetSchema(ctx)\ncls := schema.GetClass(classKey)\nnumVectors := len(cls.VectorConfig) // >1 means targetVector is mandatory\nif numVectors > 1 && nearObject.TargetVector == \"\" {\n  return fmt.Errorf(\"class %s has %d named vectors; specify targetVector\", cls.Class, numVectors)\n}","typeGuard":"func targetVectorSet(p NearObjectParams, classHasNamedVectors bool) bool {\n  return !classHasNamedVectors || (p != nil && p.TargetVector != \"\")\n}","tryCatchPattern":"res, err := runGraphQLQuery(ctx, q)\nvar ep *weaviate.ErrInvalidInput\nif errors.As(err, &ep) && strings.Contains(err.Error(), \"multiple multi vectors found\") {\n  // add targetVector and retry\n  q = addTargetVector(q, defaultTargetVector)\n  res, err = runGraphQLQuery(ctx, q)\n}","preventionTips":["Always set targetVector explicitly in queries against named-vector collections.","Pin query templates to schema versions; update them when adding named vectors.","Validate targetVector names against the class schema in CI."],"tags":["graphql","named-vectors","target-vector","near-object"],"backgroundTag":"target-vector-required","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"}