ruby/rubygems · error · InvalidOption
There are multiple gemspecs at #{expanded_path}. Please use
Error message
There are multiple gemspecs at #{expanded_path}. Please use the :name option to specify which one should be used What it means
Error "There are multiple gemspecs at #{expanded_path}. Please use the :name option to specify which one should be used" thrown in ruby/rubygems.
Source
Thrown at lib/bundler/dsl.rb:93
case specs_by_name_and_version.size
when 1
specs = specs_by_name_and_version.values.first
spec = specs.find {|s| s.installable_on_platform?(Bundler.local_platform) } || specs.first
@gemspecs << spec
path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
add_dependency spec.name
end
spec.development_dependencies.each do |dep|
add_dependency dep.name, dep.requirement.as_list, "gemspec_dev_dep" => true, "group" => development_group
end
when 0
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
else
raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \
"Please use the :name option to specify which one should be used"
end
end
def gem(name, *args)
options = args.last.is_a?(Hash) ? args.pop.dup : {}
version = args || [">= 0"]
normalize_options(name, version, options)
add_dependency(name, version, options)
end
# For usage in Dsl.evaluate, since lockfile is used as part of the Gemfile.
def lockfile_path
@lockfile
end
View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/dsl.rb:93 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/4fb5998fd0078bfa.
Report an issue: GitHub.