ruby/rubygems · error · Gem::SafeMarshal::Reader::UnsupportedVersionError
Unsupported marshal version #{v.bytes.map(&:ord).join(".")},
Error message
Unsupported marshal version #{v.bytes.map(&:ord).join(".")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION} What it means
Error "Unsupported marshal version #{v.bytes.map(&:ord).join(".")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/safe_marshal/reader.rb:52
@object_links = {}
@symbol_links = {}
end
def read!
read_header
root = read_element
raise UnconsumedBytesError, "expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}" unless @io.eof?
root
end
private
MARSHAL_VERSION = [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION].map(&:chr).join.freeze
private_constant :MARSHAL_VERSION
def read_header
v = @io.read(2)
raise UnsupportedVersionError, "Unsupported marshal version #{v.bytes.map(&:ord).join(".")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" unless v == MARSHAL_VERSION
end
def read_bytes(n)
raise NegativeLengthError if n < 0
str = @io.read(n)
raise EOFError, "expected #{n} bytes, got EOF" if str.nil?
raise DataTooShortError, "expected #{n} bytes, got #{str.inspect}" unless str.bytesize == n
str
end
def read_byte
@io.getbyte || raise(EOFError, "Unexpected EOF")
end
def read_integer
b = read_byte
case bView on GitHub (pinned to 86cbb817a3)
Solutions
- The data was marshaled by an incompatible Marshal version; regenerate it with a current Ruby
- Re-download the file from the source
When it happens
Trigger: Thrown at lib/rubygems/safe_marshal/reader.rb:52 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/347e7a7302bbcaf7.
Report an issue: GitHub.