ruby/rubygems · error · Gem::CommandLineError

--ruby and FIELD are mutually exclusive

Error message

--ruby and FIELD are mutually exclusive

What it means

Error "--ruby and FIELD are mutually exclusive" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/commands/specification_command.rb:105

      req = v
    else
      raise Gem::CommandLineError, "Unsupported version type: '#{v}'"
    end

    if !req.none? && options[:all]
      alert_error "Specify --all or -v, not both"
      terminate_interaction 1
    end

    if options[:all]
      dep = Gem::Dependency.new gem
    else
      dep = Gem::Dependency.new gem, req
    end

    field = get_one_optional_argument

    raise Gem::CommandLineError, "--ruby and FIELD are mutually exclusive" if
      field && options[:format] == :ruby

    if local?
      if File.exist? gem
        begin
          specs << Gem::Package.new(gem).spec
        rescue StandardError
          nil
        end
      end

      if specs.empty?
        specs.push(*dep.matching_specs)
      end
    end

    if remote?
      dep.prerelease = options[:prerelease]

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/commands/specification_command.rb:105 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/983f50883dc07419. Report an issue: GitHub.