ruby/rubygems · error · Gem::InstallError

The specification for #{spec.full_name} is corrupt (#{e.clas

Error message

The specification for #{spec.full_name} is corrupt (#{e.class})

What it means

Error "The specification for #{spec.full_name} is corrupt (#{e.class})" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/installer.rb:606

      # Create a plain shebang line.
      @env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
      "#!#{@env_path} #{ruby_install_name}"
    else
      "#{bash_prolog_script}#!#{Gem.ruby}#{opts}"
    end
  end

  ##
  # Ensures the Gem::Specification written out for this gem is loadable upon
  # installation.

  def ensure_loadable_spec
    ruby = spec.to_ruby_for_cache

    begin
      eval ruby
    rescue StandardError, SyntaxError => e
      raise Gem::InstallError,
            "The specification for #{spec.full_name} is corrupt (#{e.class})"
    end
  end

  def ensure_dependencies_met # :nodoc:
    deps = spec.runtime_dependencies
    deps |= spec.development_dependencies if @development

    deps.each do |dep_gem|
      ensure_dependency spec, dep_gem
    end
  end

  def process_options # :nodoc:
    @options = {
      bin_dir: nil,
      env_shebang: false,
      force: false,

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Re-download the gem; its specification is corrupt
  2. If you built the gem, rebuild it with a current RubyGems (`gem build foo.gemspec`)

When it happens

Trigger: Thrown at lib/rubygems/installer.rb:606 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/f809066b98f8ca7c. Report an issue: GitHub.