{"record":{"id":"758269ce193cce3c","repo":"mongodb/mongoid","slug":"ambiguous-associations-candidates-defined-on-758269","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/embedded/embeds_one.rb","lineNumber":147,"sourceCode":"          @owner_class.cyclic = true if cyclic?\n          @owner_class.validates_associated(name) if validate?\n        end\n\n        def relation_complements\n          @relation_complements ||= [ Embedded::EmbeddedIn ].freeze\n        end\n\n        def polymorphic_inverses(_other = nil)\n          [ as ]\n        end\n\n        def determine_inverses(_other)\n          matches = relation_class.relations.values.select do |rel|\n            relation_complements.include?(rel.class) &&\n              # https://jira.mongodb.org/browse/MONGOID-4882\n              rel.relation_class_name.sub(/\\A::/, '') == 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      end\n    end\n  end\nend\n","sourceCodeStart":129,"sourceCodeEnd":155,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/association/embedded/embeds_one.rb#L129-L155","documentation":"Error \"Ambiguous associations %{candidates} defined on %{klass}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/association/embedded/embeds_one.rb:147 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"}