{"record":{"id":"641a4a9759d40f99","repo":"mongodb/mongoid","slug":"ambiguous-associations-candidates-defined-on-641a4a","errorCode":null,"errorMessage":"Ambiguous associations %{candidates} defined on %{klass}.","messagePattern":"Ambiguous associations %(.+?) defined on %(.+?)\\.","errorType":"exception","errorClass":"Mongoid::Errors::AmbiguousRelationship","httpStatus":null,"severity":"error","filePath":"lib/mongoid/association/referenced/has_one.rb","lineNumber":183,"sourceCode":"          define_dependency!\n          @owner_class.validates_associated(name) if validate?\n          self\n        end\n\n        def default_foreign_key_field\n          @default_foreign_key_field ||= \"#{inverse}#{FOREIGN_KEY_SUFFIX}\"\n        end\n\n        def polymorphic_inverses(_other)\n          [ as ]\n        end\n\n        def determine_inverses(other)\n          matches = (other || relation_class).relations.values.select do |rel|\n            relation_complements.include?(rel.class) &&\n              rel.relation_class_name == inverse_class_name\n          end\n          raise Errors::AmbiguousRelationship.new(relation_class, @owner_class, name, matches) if matches.size > 1\n\n          matches.collect { |m| m.name } unless matches.blank?\n        end\n\n        def default_primary_key\n          PRIMARY_KEY_DEFAULT\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":165,"sourceCodeEnd":195,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/association/referenced/has_one.rb#L165-L195","documentation":"Error \"Ambiguous associations %{candidates} defined on %{klass}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/association/referenced/has_one.rb:183 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"}