{"record":{"id":"c55180398605008a","repo":"weaviate/weaviate","slug":"should-vectorize-is-vector-empty-w","errorCode":null,"errorMessage":"should vectorize: is vector empty: %w","messagePattern":"should vectorize: is vector empty: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/modules/vectorizer.go","lineNumber":458,"sourceCode":"\t\ttargetVectorExists = ok && !isVectorEmpty\n\t})\n\treturn !targetVectorExists\n}\n\nfunc (p *Provider) shouldVectorize(object *models.Object, class *models.Class,\n\ttargetVector string, logger logrus.FieldLogger,\n) (bool, error) {\n\thnswConfig, err := p.getVectorIndexConfig(class, targetVector)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvectorizer := p.getVectorizer(class, targetVector)\n\tif vectorizer == config.VectorizerModuleNone {\n\t\tvector := p.getVector(object, targetVector)\n\t\tisEmpty, err := dto.IsVectorEmpty(vector)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"should vectorize: is vector empty: %w\", err)\n\t\t}\n\t\tif hnswConfig.Skip && !isEmpty {\n\t\t\tlogger.WithField(\"className\", class.Class).\n\t\t\t\tWarningf(warningSkipVectorProvided)\n\t\t}\n\t\treturn false, nil\n\t}\n\n\tif hnswConfig.Skip {\n\t\tlogger.WithField(\"className\", class.Class).\n\t\t\tWithField(\"vectorizer\", vectorizer).\n\t\t\tWarningf(warningSkipVectorGenerated, vectorizer)\n\t}\n\treturn true, nil\n}\n\nfunc (p *Provider) getVectorizer(class *models.Class, targetVector string) string {\n\tif targetVector != \"\" && len(class.VectorConfig) > 0 {","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/modules/vectorizer.go#L440-L476","documentation":"In shouldVectorize, when the class's vectorizer is \"none\" (config.VectorizerModuleNone), Weaviate expects vectors to be supplied by the caller and only checks whether the object already has one. It calls dto.IsVectorEmpty, which switches over the vector's Go type (nil, []float32, [][]float32, C11yVector) and errors with \"unrecognized vector type: %T\" for anything else. That error is wrapped as \"should vectorize: is vector empty\". The update is aborted because the provider cannot safely determine vector emptiness.","triggerScenarios":"UpdateVector on a class with vectorizer=none where the object's vector field (object.Vector or object.Vectors[targetVector]) holds an unexpected concrete type — e.g. legacy C11yVector misuse or a custom vector representation that doesn't match models.Vector's supported cases.","commonSituations":"Objects deserialized from an older Weaviate version or a custom client sending a non-standard vector type; mixing self-provided vectors with a schema migrated across versions; tests constructing models.Object with an exotic vector type.","solutions":["Look at the wrapped %T message to see the offending vector type; convert it to []float32 (or [][]float32 for multi-vectors) before the update.","Ensure clients send vectors as standard numeric arrays via the REST/gRPC API rather than through custom deserialization.","Re-ingest or patch the affected object so its stored vector uses a supported representation.","If legacy data is involved, re-export and re-import the collection with a current client."],"exampleFix":"// before\nobj.Vector = myCustomVectorType // unrecognized\n// after\nobj.Vector = []float32(myCustomVectorType)","handlingStrategy":"type-guard","validationCode":"func hasSupportedVector(obj *models.Object) bool {\n  switch obj.Vector.(type) {\n  case nil, []float32, [][]float32, models.C11yVector:\n    return true\n  default:\n    return false\n  }\n}\n// call before update; convert otherwise","typeGuard":"func supportedVector(v models.Vector) ([]float32, bool) {\n  if f, ok := v.([]float32); ok { return f, true }\n  return nil, false\n}","tryCatchPattern":"err := client.Data().ObjectUpdater()...Do(ctx)\nif err != nil && strings.Contains(err.Error(), \"is vector empty\") {\n  // convert the vector to []float32 / [][]float32 and resend\n}","preventionTips":["Always send vectors as plain float arrays through official clients.","Avoid carrying objects built by older/custom deserializers into update calls.","Add a client-side check that vector fields match models.Vector's supported types."],"tags":["go","weaviate","vectorization","type-mismatch"],"backgroundTag":"unrecognized-vector-type","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}