ruby/rubygems · error · Gem::InstallError

"#{filename}" from #{spec.name} conflicts with #{conflict}

Error message

"#{filename}" from #{spec.name} conflicts with #{conflict}

What it means

Error ""#{filename}" from #{spec.name} conflicts with #{conflict}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/installer.rb:239

    return if Gem.default_bindir != @bin_dir && !ruby_executable

    question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup

    if ruby_executable
      question << (existing || "an unknown executable")

      return if ask_yes_no "#{question}\nOverwrite the executable?", false

      conflict = "installed executable from #{existing}"
    else
      question << generated_bin

      return if ask_yes_no "#{question}\nOverwrite the executable?", false

      conflict = generated_bin
    end

    raise Gem::InstallError,
      "\"#{filename}\" from #{spec.name} conflicts with #{conflict}"
  end

  ##
  # Lazy accessor for the spec's gem directory.

  def gem_dir
    @gem_dir ||= File.join(gem_home, "gems", spec.full_name)
  end

  ##
  # Lazy accessor for the installer's spec.

  def spec
    @package.spec
  end

  ##

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Uninstall the gem that owns the conflicting file, then reinstall
  2. Reinstall with `gem install --force` if you accept overwriting the conflicting file

When it happens

Trigger: Thrown at lib/rubygems/installer.rb:239 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/c0146dfbbe336e3d. Report an issue: GitHub.