{"record":{"id":"1d8958a6ad325d47","repo":"mongodb/mongoid","slug":"name-has-multiple-vector-search-indexes-specif","errorCode":null,"errorMessage":"#{name} has multiple vector search indexes; specify index: to select one","messagePattern":"#(.+?) has multiple vector search indexes; specify index: to select one","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/search_indexable.rb","lineNumber":441,"sourceCode":"      #\n      # @param [ String | Symbol | nil ] index The requested index name.\n      # @param [ String | Symbol | nil ] path The requested field path.\n      #\n      # @return [ Array<String> ] the resolved [ index_name, field_path ] pair.\n      def resolve_vector_index(index, path)\n        vector_specs = search_index_specs.select { |s| s[:type] == 'vectorSearch' }\n\n        raise ArgumentError, \"No vector search indexes declared on #{name}\" if vector_specs.empty?\n\n        spec = if index\n                 found = vector_specs.find { |s| s[:name] == index.to_s }\n                 raise ArgumentError, \"No vector search index '#{index}' declared on #{name}\" unless found\n\n                 found\n               elsif vector_specs.size == 1\n                 vector_specs.first\n               else\n                 raise ArgumentError,\n                       \"#{name} has multiple vector search indexes; specify index: to select one\"\n               end\n\n        resolved_index = spec[:name] || 'default'\n        resolved_path  = path ? path.to_s : infer_vector_path(spec)\n\n        [ resolved_index, resolved_path ]\n      end\n\n      # Infers the vector field path from the index definition by locating\n      # the first field declared with type 'vector'.\n      #\n      # @param [ Hash ] spec The vector search index spec.\n      #\n      # @return [ String ] the field path.\n      def infer_vector_path(spec)\n        field_list = spec.dig(:definition, :fields) || spec.dig(:definition, 'fields') || []\n        vector_field = field_list.find { |f| (f[:type] || f['type']) == 'vector' }","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/search_indexable.rb#L423-L459","documentation":"Error \"#{name} has multiple vector search indexes; specify index: to select one\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/search_indexable.rb:441 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}