ruby/rubygems · error · Gem::CommandLineError

Please specify a gem name on the command line (e.g. gem buil

Error message

Please specify a gem name on the command line (e.g. gem build GEMNAME)

What it means

Error "Please specify a gem name on the command line (e.g. gem build GEMNAME)" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/command.rb:223

  end

  def extract_gem_name_and_version(name) # :nodoc:
    if /\A(.*):(#{Gem::Requirement::PATTERN_RAW})\z/ =~ name
      [$1, $2]
    else
      [name]
    end
  end

  ##
  # Get a single gem name from the command line.  Fail if there is no gem name
  # or if there is more than one gem name given.

  def get_one_gem_name
    args = options[:args]

    if args.nil? || args.empty?
      raise Gem::CommandLineError,
            "Please specify a gem name on the command line (e.g. gem build GEMNAME)"
    end

    if args.size > 1
      raise Gem::CommandLineError,
            "Too many gem names (#{args.join(", ")}); please specify only one"
    end

    args.first
  end

  ##
  # Get a single optional argument from the command line.  If more than one
  # argument is given, return only the first. Return nil if none are given.

  def get_one_optional_argument
    args = options[:args] || []
    args.first

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/command.rb:223 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/e90339bb11962257. Report an issue: GitHub.