{"record":{"id":"e869b446c6d00d8c","repo":"ruby/rubygems","slug":"failed-to-find-end-of-ruby-script-while-reading-ge","errorCode":null,"errorMessage":"Failed to find end of Ruby script while reading gem","messagePattern":"Failed to find end of Ruby script while reading gem","errorType":"exception","errorClass":"Gem::Exception","httpStatus":null,"severity":"error","filePath":"lib/rubygems/package/old.rb","lineNumber":132,"sourceCode":"\n  def read_until_dashes(io) # :nodoc:\n    while (line = io.gets) && line.chomp.strip != \"---\" do\n      yield line if block_given?\n    end\n  end\n\n  ##\n  # Skips the Ruby self-install header in +io+.\n\n  def skip_ruby(io) # :nodoc:\n    loop do\n      line = io.gets\n\n      return if line.chomp == \"__END__\"\n      break unless line\n    end\n\n    raise Gem::Exception, \"Failed to find end of Ruby script while reading gem\"\n  end\n\n  ##\n  # The specification for this gem\n\n  def spec\n    verify\n\n    return @spec if @spec\n\n    yaml = String.new\n\n    @gem.with_read_io do |io|\n      skip_ruby io\n      read_until_dashes io do |line|\n        yaml << line\n      end\n    end","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/package/old.rb#L114-L150","documentation":"Error \"Failed to find end of Ruby script while reading gem\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/package/old.rb:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The gem file is truncated or malformed; re-download it","Rebuild old-format gems with a current RubyGems"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}