ruby/rubygems · error · ArgumentError

#{self} and #{other} have different names

Error message

#{self} and #{other} have different names

What it means

Error "#{self} and #{other} have different names" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/dependency.rb:259

  # Does this dependency match +spec+?
  #
  # NOTE:  This is not a convenience method.  Unlike #match? this method
  # returns true when +spec+ is a prerelease version even if this dependency
  # is not a prerelease dependency.

  def matches_spec?(spec)
    return false unless name === spec.name
    return true  if requirement.none?

    requirement.satisfied_by?(spec.version)
  end

  ##
  # Merges the requirements of +other+ into this dependency

  def merge(other)
    unless name == other.name
      raise ArgumentError,
            "#{self} and #{other} have different names"
    end

    default = Gem::Requirement.default
    self_req = requirement
    other_req = other.requirement

    return self.class.new name, self_req  if other_req == default
    return self.class.new name, other_req if self_req  == default

    self.class.new name, self_req.as_list.concat(other_req.as_list)
  end

  def matching_specs(platform_only = false)
    matches = Gem::Specification.find_all_by_name(name, requirement)

    if platform_only
      matches.reject! do |spec|

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/dependency.rb:259 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/f03b98d3ad679ac3. Report an issue: GitHub.