ruby/rubygems · error · ArgumentError
duplicate source #{source_description} for gem #{name}
Error message
duplicate source #{source_description} for gem #{name} What it means
Error "duplicate source #{source_description} for gem #{name}" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/request_set/gem_dependency_api.rb:705
ensure
@current_groups = nil
end
##
# Pins the gem +name+ to the given +source+. Adding a gem with the same
# name from a different +source+ will raise an exception.
def pin_gem_source(name, type = :default, source = nil)
source_description =
case type
when :default then "(default)"
when :path then "path: #{source}"
when :git then "git: #{source}"
when :source then "source: #{source}"
else "(unknown)"
end
raise ArgumentError,
"duplicate source #{source_description} for gem #{name}" if
@gem_sources.fetch(name, source) != source
@gem_sources[name] = source
end
private :pin_gem_source
##
# :category: Gem Dependencies DSL
#
# Block form for restricting gems to a set of platforms.
#
# The gem dependencies platform is different from Gem::Platform. A platform
# gem.deps.rb platform matches on the ruby engine, the ruby version and
# whether or not windows is allowed.
#
# :ruby, :ruby_XY ::View on GitHub (pinned to 86cbb817a3)
Solutions
- Remove the duplicate source block/option for the named gem in the Gemfile/gem.deps.rb
When it happens
Trigger: Thrown at lib/rubygems/request_set/gem_dependency_api.rb:705 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/afe2df80678b3b9c.
Report an issue: GitHub.