ruby/rubygems · error · InvalidOption

Removing all platforms from the bundle is not allowed

Error message

Removing all platforms from the bundle is not allowed

What it means

Error "Removing all platforms from the bundle is not allowed" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/cli/lock.rb:65

        Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]

        options["remove-platform"].flatten.each do |platform_string|
          platform = Gem::Platform.new(platform_string)
          definition.remove_platform(platform)
        end

        options["add-platform"].flatten.each do |platform_string|
          platform = Gem::Platform.new(platform_string)
          if platform.to_s == "unknown"
            Bundler.ui.error "The platform `#{platform_string}` is unknown to RubyGems and can't be added to the lockfile."
            exit 1
          end
          definition.add_platform(platform)
        end

        if definition.platforms.empty?
          raise InvalidOption, "Removing all platforms from the bundle is not allowed"
        end

        definition.remotely! unless options[:local]

        if options["normalize-platforms"]
          definition.normalize_platforms
        end

        if print
          puts definition.to_lock
        else
          file = options[:lockfile]
          file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile

          puts "Writing lockfile to #{file}"
          definition.write_lock(file, false)
        end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/cli/lock.rb:65 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/1aa0c60585524cde. Report an issue: GitHub.