ruby/ruby · error · ArgumentError

expected Array of or Hash of components of #{klass} (#{klass

Error message

expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})

What it means

Error "expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})" thrown in ruby/ruby.

Source

Thrown at lib/uri/common.rb:87

          array_hash.size == klass.component.size - 1
        klass.component[1..-1].each_index do |i|
          begin
            tmp[klass.component[i + 1]] = array_hash[i].clone
          rescue TypeError
            tmp[klass.component[i + 1]] = array_hash[i]
          end
        end

      elsif array_hash.kind_of?(Hash)
        array_hash.each do |key, value|
          begin
            tmp[key] = value.clone
          rescue TypeError
            tmp[key] = value
          end
        end
      else
        raise ArgumentError,
          "expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})"
      end
      tmp[:scheme] = klass.to_s.sub(/\A.*::/, '').downcase

      return tmp
    end
    module_function :make_components_hash
  end

  module Schemes # :nodoc:
    class << self
      ReservedChars = ".+-"
      EscapedChars = "\u01C0\u01C1\u01C2"
      # Use Lo category chars as escaped chars for TruffleRuby, which
      # does not allow Symbol categories as identifiers.

      def escape(name)
        unless name and name.ascii_only?

View on GitHub (pinned to 0e5b888e1c)

When it happens

Trigger: Thrown at lib/uri/common.rb:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/ruby@0e5b888e1c (2026-08-21). Data as JSON: /api/errors/eefcebbe92cb77fe. Report an issue: GitHub.