ruby/rubygems · error · ArgumentError
Expected 2 ints
Error message
Expected 2 ints
What it means
Error "Expected 2 ints" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:304
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)
num, den = s
raise ArgumentError, "Expected 2 ints" unless s.size == 2 && num.is_a?(Integer) && den.is_a?(Integer)
Rational(num, den)
end
end
private_constant :RationalCompat
COMPAT_CLASSES = {}.tap do |h|
h[Rational] = RationalCompat
end.compare_by_identity.freeze
private_constant :COMPAT_CLASSES
def resolve_ivar(klass, name)
to_s = resolve_symbol_name(name)
raise UnpermittedIvarError.new(symbol: to_s, klass: klass, stack: formatted_stack) unless @permitted_ivars.fetch(klass.name, [].freeze).include?(to_s)
visit_symbol_type(name)
end
View on GitHub (pinned to 86cbb817a3)
Solutions
- The marshal data is corrupt (rational/complex structure incomplete); re-download the gem
When it happens
Trigger: Thrown at lib/rubygems/safe_marshal/visitors/to_ruby.rb:304 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/02e8f3acf387c74c.
Report an issue: GitHub.