{"record":{"id":"a20469e1694df8cf","repo":"ruby/ruby","slug":"unknown-platform-platform-name-inspect","errorCode":null,"errorMessage":"unknown platform #{platform_name.inspect}","messagePattern":"unknown platform #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/request_set/gem_dependency_api.rb","lineNumber":543,"sourceCode":"\n    true\n  end\n\n  private :gem_source\n\n  ##\n  # Handles the platforms: option from +options+.  Returns true if the\n  # platform matches the current platform.\n\n  def gem_platforms(name, options) # :nodoc:\n    platform_names = Array(options.delete(:platform))\n    platform_names.concat Array(options.delete(:platforms))\n    platform_names.concat @current_platforms if @current_platforms\n\n    return true if platform_names.empty?\n\n    platform_names.any? do |platform_name|\n      raise ArgumentError, \"unknown platform #{platform_name.inspect}\" unless\n        platform = PLATFORM_MAP[platform_name]\n\n      next false unless Gem::Platform.match_gem? platform, name\n\n      if engines = ENGINE_MAP[platform_name]\n        next false unless engines.include? Gem.ruby_engine\n      end\n\n      case WINDOWS[platform_name]\n      when :only then\n        next false unless Gem.win_platform?\n      when :never then\n        next false if Gem.win_platform?\n      end\n\n      VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version\n    end\n  end","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/lib/rubygems/request_set/gem_dependency_api.rb#L525-L561","documentation":"In the RubyGems dependencies DSL, every platform passed to `gem 'x', platform(s):` (or inside a `platform :foo do ... end` block) is looked up in PLATFORM_MAP. A symbol not present there raises ArgumentError immediately. Supported names include :ruby/:ruby_XY, :mri/:mri_XY, :mingw, :x64_mingw, :mswin, :mswin64, :jruby, :maglev, :rbx (and their _XY variants).","triggerScenarios":"`gem 'x', platforms: :macos` (macos/darwin is not a recognized platform here), a typo like :mignw, or a Bundler-only/legacy name such as :mswin_19. The lookup is PLATFORM_MAP[platform_name] inside gem_platforms, raised before any matching logic runs.","commonSituations":"Copying Bundler Gemfile platform symbols into a gems.rb processed by RubyGems itself; assuming OS-based names (:linux, :macos, :windows) exist in this DSL - only :windows-style entries like mswin/mingw are modeled; typos from hand-editing.","solutions":["Use one of the recognized names: :ruby, :mri, :mingw, :x64_mingw, :mswin, :mswin64, :jruby, :maglev, :rbx (optionally with _XY version suffixes)","For unix-like non-windows MRI, use :ruby or :mri instead of :linux/:macos","Fix the typo so the symbol matches a PLATFORM_MAP key exactly"],"exampleFix":"# before\ngem 'libv8', platforms: :macos\n\n# after\ngem 'libv8', platforms: :ruby","handlingStrategy":"validation","validationCode":"VALID = %i[ruby mri mingw x64_mingw mswin mswin64 jruby maglev rbx].freeze\nbad = platforms.reject { |p| VALID.include?(p.to_s.sub(/_\\d+\\z/, '').to_sym) }\nabort \"unknown platforms: #{bad.inspect}\" unless bad.empty?\n# then write/use `gem 'x', platforms: ...`","typeGuard":null,"tryCatchPattern":"begin\n  Gem::RequestSet.new.import(gems_rb)\nrescue ArgumentError => e\n  raise if !e.message.include?('unknown platform')\n  abort \"#{gems_rb}: #{e.message} - allowed: :ruby, :mri, :mingw, :x64_mingw, :mswin, :mswin64, :jruby, :maglev, :rbx\"\nend","preventionTips":["Treat the RubyGems DSL platforms as engine-based, not OS-based (:macos/:linux do not exist)","Lint platform symbols in gems.rb in CI with the allowed-list above","Do not assume Bundler Gemfile platform names transfer unchanged"],"tags":["rubygems","platform","gemfile","gem-dependency-api","dsl"],"backgroundTag":"unknown-platform-identifier","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}