ruby/rubygems · error · Gem::SafeMarshal::Visitors::ToRuby::UnsupportedError

Unsupported user class #{resolve_class(r.name)} in marshal s

Error message

Unsupported user class #{resolve_class(r.name)} in marshal stream @ #{stack.join(".")}

What it means

Error "Unsupported user class #{resolve_class(r.name)} in marshal stream @ #{stack.join(".")}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:284

          hash = register_object({}.compare_by_identity)

          o = r.wrapped_object
          o.pairs.each_with_index do |(k, v), i|
            push_stack i
            k = visit(k)
            push_stack k
            hash[k] = visit(v)
          end

          if o.is_a?(Elements::HashWithDefaultValue)
            push_stack :default
            hash.default = visit(o.default)
          end

          hash
        else
          raise UnsupportedError.new("Unsupported user class #{resolve_class(r.name)} in marshal stream", stack: formatted_stack)
        end
      end

      def resolve_class(n)
        @class_cache[n] ||= begin
          to_s = resolve_symbol_name(n)
          raise UnpermittedClassError.new(name: to_s, stack: formatted_stack) unless @permitted_classes.include?(to_s)
          visit_symbol_type(n)
          begin
            ::Object.const_get(to_s)
          rescue NameError
            raise ArgumentError, "Undefined class #{to_s.inspect}"
          end
        end
      end

      class RationalCompat
        def marshal_load(s)

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. The metadata embeds an unsupported user class; rebuild the gem with a current RubyGems

When it happens

Trigger: Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:284 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/efc4037d849272cd. Report an issue: GitHub.