{"record":{"id":"a5e6e4f66f9feff5","repo":"mongodb/mongoid","slug":"cannot-infer-path-on-name-no-autoembed-field","errorCode":null,"errorMessage":"Cannot infer path on #{name}: no 'autoEmbed' field in index definition; specify path:","messagePattern":"Cannot infer path on #(.+?): no 'autoEmbed' field in index definition; specify path:","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/search_indexable.rb","lineNumber":524,"sourceCode":"          specs.first\n        else\n          raise ArgumentError,\n                \"#{name} has multiple auto-embed indexes; specify index: to select one\"\n        end\n      end\n\n      # Infers the text field path from an index definition by locating\n      # the first field declared with type 'autoEmbed'.\n      #\n      # @param [ Hash ] spec The vector search index spec.\n      #\n      # @return [ String ] the field path.\n      def infer_auto_embed_path(spec)\n        field_list = spec.dig(:definition, :fields) || spec.dig(:definition, 'fields') || []\n        ae_field   = field_list.find { |f| (f[:type] || f['type']) == 'autoEmbed' }\n\n        unless ae_field\n          raise ArgumentError,\n                \"Cannot infer path on #{name}: no 'autoEmbed' field in index definition; specify path:\"\n        end\n\n        (ae_field[:path] || ae_field['path']).to_s\n      end\n    end\n  end\nend\n","sourceCodeStart":506,"sourceCodeEnd":533,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/search_indexable.rb#L506-L533","documentation":"Error \"Cannot infer path on #{name}: no 'autoEmbed' field in index definition; specify path:\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/search_indexable.rb:524 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"}