ruby/rubygems · error · Psych::DisallowedClass
Tried to load unspecified class: #{tag}
Error message
Tried to load unspecified class: #{tag} What it means
Error "Tried to load unspecified class: #{tag}" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/yaml_serializer.rb:662
def pairs_to_hash(node)
result = {}
node.pairs.each do |key_node, value_node|
key = key_node.is_a?(Scalar) ? key_node.value.to_s : build_node(key_node).to_s
result[key] = build_node(value_node)
end
result
end
def validate_tag!(tag)
return if @permitted_classes.include?(tag)
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)View on GitHub (pinned to 86cbb817a3)
Solutions
- 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:662 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/98d778cd6809fa05.
Report an issue: GitHub.