ruby/rubygems · error · Gem::InstallError
#{spec} has an invalid specification_version
Error message
#{spec} has an invalid specification_version What it means
Error "#{spec} has an invalid specification_version" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/installer.rb:705
def verify_spec
unless Gem::Specification::VALID_NAME_PATTERN.match?(spec.name)
raise Gem::InstallError, "#{spec} has an invalid name"
end
if spec.raw_require_paths.any? {|path| path =~ /\R/ }
raise Gem::InstallError, "#{spec} has an invalid require_paths"
end
if spec.extensions.any? {|ext| ext =~ /\R/ }
raise Gem::InstallError, "#{spec} has an invalid extensions"
end
unless /\A[\w.-]+\z/.match?(spec.platform.to_s)
raise Gem::InstallError, "#{spec.platform} is an invalid platform"
end
unless /\A\d+\z/.match?(spec.specification_version.to_s)
raise Gem::InstallError, "#{spec} has an invalid specification_version"
end
if spec.dependencies.any? {|dep| dep.type != :runtime && dep.type != :development }
raise Gem::InstallError, "#{spec} has an invalid dependencies"
end
if spec.dependencies.any? {|dep| dep.name =~ /(?:\R|[<>])/ }
raise Gem::InstallError, "#{spec} has an invalid dependencies"
end
if spec.executables.any? {|name| !name.is_a?(String) || name != File.basename(name) || /\A\.\.?\z|\R/.match?(name) }
raise Gem::InstallError, "#{spec} has an invalid executable"
end
raise Gem::InstallError, "#{spec} has an invalid bindir" unless spec.bindir.is_a?(String)
expanded_gem_dir = File.expand_path(gem_dir)
expanded_bindir = File.expand_path(File.join(gem_dir, spec.bindir))View on GitHub (pinned to 86cbb817a3)
Solutions
- Set a valid `spec.specification_version` (currently 4) or remove the assignment so RubyGems uses the default
When it happens
Trigger: Thrown at lib/rubygems/installer.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/45e0f00370e78f26.
Report an issue: GitHub.