ruby/rubygems · error · Gem::SafeMarshal::Reader::Error

Unknown marshal type discriminator #{type.chr.inspect} (#{ty

Error message

Unknown marshal type discriminator #{type.chr.inspect} (#{type})

What it means

Error "Unknown marshal type discriminator #{type.chr.inspect} (#{type})" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/safe_marshal/reader.rb:140

        when 85 then read_user_marshal # ?U
        when 91 then read_array # ?[
        when 102 then read_float # ?f
        when 105 then Elements::Integer.new(read_integer) # ?i
        when 108 then read_bignum # ?l
        when 111 then read_object # ?o
        when 117 then read_user_defined # ?u
        when 123 then read_hash # ?{
        when 125 then read_hash_with_default_value # ?}
        when 101 then read_extended_object # ?e
        when 99 then read_class # ?c
        when 109 then read_module # ?m
        when 77 then read_class_or_module # ?M
        when 100 then read_data # ?d
        when 47 then read_regexp # ?/
        when 83 then read_struct # ?S
        when 67 then read_user_class # ?C
        else
          raise Error, "Unknown marshal type discriminator #{type.chr.inspect} (#{type})"
        end
      end

      STRING_E_SYMBOL = Elements::Symbol.new("E").freeze
      private_constant :STRING_E_SYMBOL

      def read_symbol
        len = read_integer
        if len == 1
          byte = read_byte
          if byte == 69 # ?E
            STRING_E_SYMBOL
          else
            Elements::Symbol.new(byte.chr)
          end
        else
          name = read_bytes(len)
          Elements::Symbol.new(name)

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. The marshal stream contains an unknown type tag; the file is corrupt or tampered — re-download it

When it happens

Trigger: Thrown at lib/rubygems/safe_marshal/reader.rb:140 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/344919c6561c6e7b. Report an issue: GitHub.