{"record":{"id":"e5cbc16a6cd3763a","repo":"weaviate/weaviate","slug":"inputs-are-not-equal-to-vectors-returned-e5cbc1","errorCode":null,"errorMessage":"inputs are not equal to vectors returned","messagePattern":"inputs are not equal to vectors returned","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/modulecomponents/vectorizer/batchclip/batch_clip_vectorizer.go","lineNumber":115,"sourceCode":"\tvecs, err := v.objects(ctx, []*models.Object{obj}, cfg)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif len(vecs) != 1 {\n\t\treturn nil, nil, fmt.Errorf(\"more than one embedding found for object: %s\", obj.ID)\n\t}\n\treturn vecs[0], nil, err\n}\n\nfunc (v *BatchCLIPVectorizer[T]) Texts(ctx context.Context,\n\tinputs []string, cfg moduletools.ClassConfig,\n) (T, error) {\n\tres, err := v.client.VectorizeQuery(ctx, inputs, cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"remote client vectorize: %w\", err)\n\t}\n\tif len(inputs) != len(res.TextVectors) {\n\t\treturn nil, errors.New(\"inputs are not equal to vectors returned\")\n\t}\n\tvector, err := v.combineVectors(res.TextVectors, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vector, nil\n}\n\nfunc (v *BatchCLIPVectorizer[T]) VectorizeImage(ctx context.Context,\n\tid, image string, cfg moduletools.ClassConfig,\n) (T, error) {\n\tres, err := v.client.VectorizeImages(ctx, []string{image}, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(res.ImageVectors) != 1 {\n\t\treturn nil, errors.New(\"more than one embedding found for image\")\n\t}","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/modulecomponents/vectorizer/batchclip/batch_clip_vectorizer.go#L97-L133","documentation":"In the multi-vector CLIP vectorizer, Texts() calls the remote inference client (VectorizeQuery) and expects the result to contain exactly one embedding per input text. If the number of returned TextVectors differs from the number of inputs, the request/response contract with the inference container is broken, so it refuses to combine vectors and returns this error. It guards against silent misalignment of inputs and embeddings.","triggerScenarios":"Calling Texts() (directly via nearText vectorization or batch imports using a multi-vector CLIP module like multi2vec-clip/multi2vec-bind) when the remote CLIP inference service returns a different count of text vectors than the number of input strings — e.g. inference drops empty strings, truncates the batch, or returns an empty result on a partial failure.","commonSituations":"Mismatched versions of Weaviate and the inference container (text2vec/multi2vec CLIP service upgraded independently); an inference backend that silently skips blank or invalid text inputs; a proxy/load balancer in front of inference mangling the batch response; overloaded inference returning partial batches.","solutions":["Check that the Weaviate inference container (semitechnologies/series or inference service) version matches the Weaviate version; upgrade both to compatible releases.","Remove empty or blank strings from the input batch before vectorizing — some inference backends skip them, breaking the 1:1 mapping.","Log len(inputs) and len(res.TextVectors) at the inference client boundary to identify whether inputs are dropped or duplicated.","Retry the request; transient inference failures can produce partial responses.","If operating as a module developer, make the inference client return an error instead of a short result so this mismatch cannot occur."],"exampleFix":"// before\ninputs := []string{text1, \"\", text3}\nvector, err := vectorizer.Texts(ctx, inputs, cfg)\n// after\nnonEmpty := make([]string, 0, len(inputs))\nfor _, t := range inputs {\n\tif strings.TrimSpace(t) != \"\" {\n\t\tnonEmpty = append(nonEmpty, t)\n\t}\n}\nvector, err := vectorizer.Texts(ctx, nonEmpty, cfg)","handlingStrategy":"validation","validationCode":"if len(inputs) == 0 || containsEmpty(inputs) {\n\treturn fmt.Errorf(\"refusing to vectorize: %d inputs, empty strings present\", len(inputs))\n}","typeGuard":"func vectorsMatchInputs[T dto.Embedding](inputs []string, res *modulecomponents.VectorizationCLIPResult[T]) bool {\n\treturn res != nil && len(res.TextVectors) == len(inputs)\n}","tryCatchPattern":"vector, err := vectorizer.Texts(ctx, inputs, cfg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"inputs are not equal to vectors returned\") {\n\t\treturn reconcileBatch(ctx, vectorizer, inputs, cfg) // split and vectorize individually\n\t}\n\treturn fmt.Errorf(\"vectorize: %w\", err)\n}","preventionTips":["Pin inference container versions to the matching Weaviate release.","Filter out empty/blank strings from batches before vectorizing.","Add a pre-flight smoke test that vectorizes a small known batch at startup.","Split large batches so partial inference failures are easier to isolate."],"tags":["vectorization","clip","inference-service","batch"],"backgroundTag":"vectorizer-input-output-count-mismatch","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"}