{"record":{"id":"57d40b76a437c110","repo":"ruby/rubygems","slug":"expected-eof-got-io-read-10-inspect-after","errorCode":null,"errorMessage":"expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}","messagePattern":"expected EOF, got #(.+?)\\.\\.\\. after top-level element #(.+?)","errorType":"exception","errorClass":"Gem::SafeMarshal::Reader::UnconsumedBytesError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/safe_marshal/reader.rb","lineNumber":41,"sourceCode":"      class DataTooShortError < Error\n      end\n\n      class NegativeLengthError < Error\n      end\n\n      class LengthTooLongError < Error\n      end\n\n      def initialize(io)\n        @io = io\n        @object_links = {}\n        @symbol_links = {}\n      end\n\n      def read!\n        read_header\n        root = read_element\n        raise UnconsumedBytesError, \"expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}\" unless @io.eof?\n        root\n      end\n\n      private\n\n      MARSHAL_VERSION = [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION].map(&:chr).join.freeze\n      private_constant :MARSHAL_VERSION\n\n      def read_header\n        v = @io.read(2)\n        raise UnsupportedVersionError, \"Unsupported marshal version #{v.bytes.map(&:ord).join(\".\")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}\" unless v == MARSHAL_VERSION\n      end\n\n      def read_bytes(n)\n        raise NegativeLengthError if n < 0\n        str = @io.read(n)\n        raise EOFError, \"expected #{n} bytes, got EOF\" if str.nil?\n        raise DataTooShortError, \"expected #{n} bytes, got #{str.inspect}\" unless str.bytesize == n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/safe_marshal/reader.rb#L23-L59","documentation":"Error \"expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/safe_marshal/reader.rb:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The marshal stream has trailing garbage; re-download the gem/metadata","Rebuild the gem if you generated its metadata"],"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"}