ruby/rubygems · error · TypeError

Unexpected class %s present in marshaled data. Only %s are a

Error message

Unexpected class %s present in marshaled data. Only %s are allowed.

What it means

Error "Unexpected class %s present in marshaled data. Only %s are allowed." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/safe_marshal.rb:22

  module SafeMarshal
    ALLOWED_CLASSES = [
      Array,
      FalseClass,
      Gem::Specification,
      Gem::Version,
      Hash,
      String,
      Symbol,
      Time,
      TrueClass,
    ].freeze

    ERROR = "Unexpected class %s present in marshaled data. Only %s are allowed."

    PROC = proc do |object|
      object.tap do
        unless ALLOWED_CLASSES.include?(object.class)
          raise TypeError, format(ERROR, object.class, ALLOWED_CLASSES.join(", "))
        end
      end
    end

    def self.proc
      PROC
    end
  end
end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/safe_marshal.rb:22 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/dc65bf1af8a06877. Report an issue: GitHub.