ruby/rubygems · error · Psych::DisallowedClass

Tried to load unspecified class: #{label}

Error message

Tried to load unspecified class: #{label}

What it means

Error "Tried to load unspecified class: #{label}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/yaml_serializer.rb:673

        raise_disallowed_class!(tag)
      end

      def raise_disallowed_class!(tag)
        if defined?(Psych::VERSION)
          raise Psych::DisallowedClass.new("load", tag)
        else
          raise Psych::DisallowedClass, "Tried to load unspecified class: #{tag}"
        end
      end

      def validate_symbol!(name)
        return if @permitted_symbols.empty? || @permitted_symbols.include?(name)

        label = ":#{name}"
        if defined?(Psych::VERSION)
          raise Psych::DisallowedClass.new("load", label)
        else
          raise Psych::DisallowedClass, "Tried to load unspecified class: #{label}"
        end
      end

      def normalize_specification_version!(hash)
        val = hash["specification_version"]
        return unless val && !val.is_a?(Integer)
        hash["specification_version"] = val.to_i if val.is_a?(String) && /\A\d+\z/.match?(val)
      end

      def normalize_array_fields!(hash)
        ARRAY_FIELDS.each do |field|
          hash[field] = normalize_array_field(hash[field]) if hash[field]
        end
      end

      def normalize_array_field(value)
        if value.is_a?(Hash)
          value.values.flatten.compact

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Do not trust the YAML: it references a class outside the permitted set; re-download from the official source

When it happens

Trigger: Thrown at lib/rubygems/yaml_serializer.rb:673 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/5c0137dc9f6ff0f7. Report an issue: GitHub.