ruby/rubygems · error · Gem::Exception

YAML data doesn't evaluate to gem specification

Error message

YAML data doesn't evaluate to gem specification

What it means

Error "YAML data doesn't evaluate to gem specification" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/specification.rb:1056

  # Special loader for YAML files.  When a Specification object is loaded
  # from a YAML file, it bypasses the normal Ruby object initialization
  # routine (#initialize).  This method makes up for that and deals with
  # gems of different ages.
  #
  # +input+ can be anything that YAML.load() accepts: String or IO.

  def self.from_yaml(input)
    Gem.load_yaml

    input = normalize_yaml_input input
    spec = Gem::SafeYAML.safe_load input

    if spec && spec.class == FalseClass
      raise Gem::EndOfYAMLException
    end

    unless Gem::Specification === spec
      raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
    end

    spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
    spec.reset_nil_attributes_to_default
    spec.flatten_require_paths

    spec
  end

  ##
  # Return the latest specs, optionally including prerelease specs if
  # +prerelease+ is true.

  def self.latest_specs(prerelease = false)
    specification_record.latest_specs(prerelease)
  end

  ##

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. The YAML metadata does not contain a Gem::Specification; rebuild the gem with a current RubyGems

When it happens

Trigger: Thrown at lib/rubygems/specification.rb:1056 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/cfe921947ae9b3bc. Report an issue: GitHub.