ruby/rubygems · error · ArgumentError

unknown platform #{platform_name.inspect}

Error message

unknown platform #{platform_name.inspect}

What it means

Error "unknown platform #{platform_name.inspect}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/request_set/gem_dependency_api.rb:543

    true
  end

  private :gem_source

  ##
  # Handles the platforms: option from +options+.  Returns true if the
  # platform matches the current platform.

  def gem_platforms(name, options) # :nodoc:
    platform_names = Array(options.delete(:platform))
    platform_names.concat Array(options.delete(:platforms))
    platform_names.concat @current_platforms if @current_platforms

    return true if platform_names.empty?

    platform_names.any? do |platform_name|
      raise ArgumentError, "unknown platform #{platform_name.inspect}" unless
        platform = PLATFORM_MAP[platform_name]

      next false unless Gem::Platform.match_gem? platform, name

      if engines = ENGINE_MAP[platform_name]
        next false unless engines.include? Gem.ruby_engine
      end

      case WINDOWS[platform_name]
      when :only then
        next false unless Gem.win_platform?
      when :never then
        next false if Gem.win_platform?
      end

      VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version
    end
  end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Use a known platform name in the Gemfile (e.g. :ruby, :mri, :mingw, :x64_mingw, :jruby)

When it happens

Trigger: Thrown at lib/rubygems/request_set/gem_dependency_api.rb:543 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/ca3cbb35d8e68cac. Report an issue: GitHub.