ruby/rubygems · error · Gem::InvalidSpecificationException
#{spec.name} #{spec.version} has an invalid gemspec
Error message
#{spec.name} #{spec.version} has an invalid gemspec What it means
Error "#{spec.name} #{spec.version} has an invalid gemspec" thrown in ruby/rubygems.
Source
Thrown at lib/bundler/installer.rb:224
# their .gem files, so keep resolution memory around in that case.
# The bundler spec itself is excluded because it comes from the
# metadata source and never goes through that path.
@definition.release_resolution_memory! if specs.none? {|s| s.default_gem? && s.source.is_a?(Source::Rubygems) }
spec_installations = ParallelInstaller.call(self, specs, jobs, standalone, force, local: local)
spec_installations.each do |installation|
post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
end
end
def load_plugins
Gem.load_plugins
requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
path_plugin_files = requested_path_gems.flat_map do |spec|
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
rescue TypeError
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
raise Gem::InvalidSpecificationException, error_message
end
Gem.load_plugin_files(path_plugin_files)
Gem.load_env_plugins
end
def ensure_specs_are_compatible!
overrides = @definition.overrides
@definition.specs.each do |spec|
unless spec.matches_current_ruby_with_overrides?(overrides)
raise InstallError, incompatibility_message(spec, "requires ruby version #{spec.required_ruby_version}, " \
"which is incompatible with the current version, #{Gem.ruby_version}")
end
unless spec.matches_current_rubygems_with_overrides?(overrides)
raise InstallError, incompatibility_message(spec, "requires rubygems version #{spec.required_rubygems_version}, " \
"which is incompatible with the current version, #{Gem.rubygems_version}")
end
end
endView on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/bundler/installer.rb:224 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/239f933cef70896a.
Report an issue: GitHub.