{"record":{"id":"d0d1385a00c5917f","repo":"weaviate/weaviate","slug":"cannot-combine-nearvector-and-vector-in-hybrid-sea","errorCode":null,"errorMessage":"cannot combine nearVector and vector in hybrid search","messagePattern":"cannot combine nearVector and vector in hybrid search","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/grpc/v1/parse_search_request.go","lineNumber":438,"sourceCode":"\n\tif req.GroupBy != nil {\n\t\tgroupBy, err := extractGroupBy(req.GroupBy, &out, class)\n\t\tif err != nil {\n\t\t\treturn dto.GetParams{}, err\n\t\t}\n\t\tout.AdditionalProperties.Group = true\n\n\t\tout.GroupBy = groupBy\n\t}\n\n\tif out.HybridSearch != nil && out.HybridSearch.NearTextParams != nil && out.HybridSearch.NearVectorParams != nil {\n\t\treturn dto.GetParams{}, errors.New(\"cannot combine nearText and nearVector in hybrid search\")\n\t}\n\tif out.HybridSearch != nil && out.HybridSearch.NearTextParams != nil && out.HybridSearch.Vector != nil {\n\t\treturn dto.GetParams{}, errors.New(\"cannot combine nearText and query in hybrid search\")\n\t}\n\tif out.HybridSearch != nil && out.HybridSearch.NearVectorParams != nil && out.HybridSearch.Vector != nil {\n\t\treturn dto.GetParams{}, errors.New(\"cannot combine nearVector and vector in hybrid search\")\n\t}\n\tif out.Selection != nil {\n\t\tif mmr := out.Selection.MMR; mmr != nil {\n\t\t\tif mmr.Limit == 0 {\n\t\t\t\treturn dto.GetParams{}, errors.New(\"MMR limit must be at least 1\")\n\t\t\t}\n\t\t\tif out.Pagination.Limit > 0 && int(mmr.Limit) > out.Pagination.Limit {\n\t\t\t\treturn dto.GetParams{}, fmt.Errorf(\"MMR limit (%d) cannot be larger than the query limit (%d)\", mmr.Limit, out.Pagination.Limit)\n\t\t\t}\n\t\t\tif mmr.Balance < 0 || mmr.Balance > 1 {\n\t\t\t\treturn dto.GetParams{}, errors.New(\"MMR balance must be between 0 and 1\")\n\t\t\t}\n\t\t}\n\t\tselectionTargets := targetVectors\n\t\tif len(selectionTargets) == 0 {\n\t\t\tselectionTargets = []string{\"\"}\n\t\t}\n\t\tfor _, tv := range selectionTargets {","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/grpc/v1/parse_search_request.go#L420-L456","documentation":"The parser rejects hybrid search requests that set both NearVectorParams and an explicit Vector field, since both specify the query vector directly. Only one explicit vector source may be provided per hybrid search.","triggerScenarios":"Hybrid search where HybridSearch.NearVectorParams != nil and HybridSearch.Vector != nil at the same time, e.g. client populates both nearVector.vector and the top-level vector field of the hybrid search message.","commonSituations":"Duplicated vector input after API upgrades where both fields exist; helper libraries that set the vector field as a default while also building nearVector params; copy-pasted request-building code.","solutions":["Keep only one of nearVector params or the explicit vector field in the hybrid search request","If explicit vectors are desired, drop the nearVector params and set Vector directly (or vice versa)","Audit client request builders to ensure mutually exclusive fields are never populated together"],"exampleFix":"// before\nhybrid := &pb.Hybrid{\n  Vector: vec,\n  NearVectorParams: &pb.HybridNearVector{Vector: vec},\n}\n// after\nhybrid := &pb.Hybrid{\n  NearVectorParams: &pb.HybridNearVector{Vector: vec},\n}","handlingStrategy":"validation","validationCode":"func validateHybridVec(h *pb.Hybrid) error {\n  if h == nil { return nil }\n  if h.NearVectorParams != nil && h.Vector != nil {\n    return errors.New(\"set only one of nearVector or vector in hybrid search\")\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one canonical way to pass explicit vectors (prefer the vector field or nearVector, not both)","Add unit tests for request builders asserting mutual exclusivity"],"tags":["grpc","hybrid-search","request-validation"],"backgroundTag":"conflicting-search-parameters","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"}