ruby/rubygems · error · ArgumentError

invalid argument #{arch.inspect}

Error message

invalid argument #{arch.inspect}

What it means

Error "invalid argument #{arch.inspect}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/platform.rb:126

                      when /(mswin\d+)(?:[_-](\d+))?/ then
                        os = $1
                        version = $2
                        @cpu = "x86" if @cpu.nil? && os.end_with?("32")
                        [os, version]
                      when /netbsdelf/ then                  ["netbsdelf", nil]
                      when /openbsd-?(\d+\.\d+)?/ then       ["openbsd",   $1]
                      when /solaris-?(\d+\.\d+)?/ then       ["solaris",   $1]
                      when /wasi/ then                       ["wasi",      nil]
                      # test
                      when /^(\w+_platform)-?(\d+)?/ then    [$1,          $2]
                      else ["unknown", nil]
      end
    when Gem::Platform then
      @cpu = arch.cpu
      @os = arch.os
      @version = arch.version
    else
      raise ArgumentError, "invalid argument #{arch.inspect}"
    end
  end

  def to_a
    [@cpu, @os, @version]
  end

  def to_s
    to_a.compact.join(@cpu.nil? ? "" : "-")
  end

  ##
  # Deconstructs the platform into an array for pattern matching.
  # Returns [cpu, os, version].
  #
  #   Gem::Platform.new("x86_64-linux").deconstruct  #=> ["x86_64", "linux", nil]
  #
  # This enables array pattern matching:

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Pass a valid architecture string (e.g. 'x86_64-linux') or Gem::Platform object instead of the reported value

When it happens

Trigger: Thrown at lib/rubygems/platform.rb:126 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/74564a94f6b0cf8a. Report an issue: GitHub.