ruby/rubygems · error · Psych::SyntaxError
exceeded maximum nesting depth (#{MAX_NESTING_DEPTH})
Error message
exceeded maximum nesting depth (#{MAX_NESTING_DEPTH}) What it means
Error "exceeded maximum nesting depth (#{MAX_NESTING_DEPTH})" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/yaml_serializer.rb:410
def consume_value_anchor(val)
return [nil, val] unless val =~ /^&(\S+)\s+/
anchor = $1
[anchor, val.sub(/^&#{Regexp.escape(anchor)}\s+/, "")]
end
def register_anchor(name, node)
if name
@anchors[name] = node
node.anchor = name if node.respond_to?(:anchor=)
end
node
end
def raise_max_nesting!
message = "exceeded maximum nesting depth (#{MAX_NESTING_DEPTH})"
if defined?(Psych::VERSION)
raise Psych::SyntaxError.new(nil, 0, 0, 0, message, nil)
else
raise Psych::SyntaxError, message
end
end
def skip_blank_and_comments
while @lines.any?
line = @lines[0]
stripped = line.lstrip
break unless stripped.empty? || stripped.start_with?("#")
@lines.shift
end
end
def strip_comment(val)
return val unless val.include?("#")
return "" if val.lstrip.start_with?("#")
View on GitHub (pinned to 86cbb817a3)
Solutions
- Reduce nesting in the YAML metadata; the structure exceeds the maximum allowed depth
- If the gem is third-party, report the malformed metadata to its author
When it happens
Trigger: Thrown at lib/rubygems/yaml_serializer.rb:410 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/48e0d2ab172afc0b.
Report an issue: GitHub.