{"record":{"id":"0f48c9420af120b5","repo":"mongodb/mongoid","slug":"no-auto-embed-indexes-declared-on-name","errorCode":null,"errorMessage":"No auto-embed indexes declared on #{name}","messagePattern":"No auto-embed indexes declared on #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/search_indexable.rb","lineNumber":483,"sourceCode":"\n        (vector_field[:path] || vector_field['path']).to_s\n      end\n\n      # Resolves the index name and text field path for an auto-embedding\n      # query, applying inference when either is omitted.\n      #\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_auto_embed_index(index, path)\n        auto_embed_specs = search_index_specs.select do |s|\n          s[:type] == 'vectorSearch' &&\n            (s.dig(:definition, :fields) || s.dig(:definition, 'fields') || [])\n              .any? { |f| (f[:type] || f['type']) == 'autoEmbed' }\n        end\n\n        raise ArgumentError, \"No auto-embed indexes declared on #{name}\" if auto_embed_specs.empty?\n\n        # Extracted to keep cyclomatic complexity within RuboCop's threshold.\n        spec = select_auto_embed_spec(auto_embed_specs, index)\n        resolved_index = spec[:name] || 'default'\n        resolved_path  = path ? path.to_s : infer_auto_embed_path(spec)\n\n        [ resolved_index, resolved_path ]\n      end\n\n      # Picks one spec from the list of auto-embed specs, guided by +index+.\n      #\n      # @param [ Array<Hash> ] specs The candidate auto-embed specs.\n      # @param [ String | Symbol | nil ] index The requested index name.\n      #\n      # @return [ Hash ] the selected spec.\n      def select_auto_embed_spec(specs, index)\n        if index\n          found = specs.find { |s| s[:name] == index.to_s }","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/search_indexable.rb#L465-L501","documentation":"Error \"No auto-embed indexes declared on #{name}\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/search_indexable.rb:483 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"}