ruby/rubygems · error · RuntimeError
Unable to determine name from existing gemspec. Use :name =>
Error message
Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it.
What it means
Error "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." thrown in ruby/rubygems.
Source
Thrown at lib/bundler/gem_helper.rb:36
def tag_prefix=(prefix)
instance.tag_prefix = prefix
end
def gemspec(&block)
gemspec = instance.gemspec
block&.call(gemspec)
gemspec
end
end
attr_reader :spec_path, :base, :gemspec
attr_writer :tag_prefix
def initialize(base = nil, name = nil)
@base = File.expand_path(base || SharedHelpers.pwd)
gemspecs = name ? [File.join(@base, "#{name}.gemspec")] : Gem::Util.glob_files_in_dir("{,*}.gemspec", @base)
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
@spec_path = gemspecs.first
@gemspec = Bundler.load_gemspec(@spec_path)
@tag_prefix = ""
end
def install
built_gem_path = nil
desc "Build #{name}-#{version}.gem into the pkg directory."
task "build" do
built_gem_path = build_gem
end
desc "Generate SHA512 checksum of #{name}-#{version}.gem into the checksums directory."
task "build:checksum" => "build" do
build_checksum(built_gem_path)
end
View on GitHub (pinned to 86cbb817a3)
Solutions
- Add :name => 'gemname' to the install_tasks call in your Rakefile
- Or ensure a single valid gemspec exists so the name can be inferred
When it happens
Trigger: Thrown at lib/bundler/gem_helper.rb:36 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/09742b5c28e7f565.
Report an issue: GitHub.