ruby/rubygems · error · Gem::CommandLineError

Ambiguous command #{cmd_name} matches [#{possibilities.join(

Error message

Ambiguous command #{cmd_name} matches [#{possibilities.join(", ")}]

What it means

Error "Ambiguous command #{cmd_name} matches [#{possibilities.join(", ")}]" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/command_manager.rb:203

      else
        alert_error clean_text("#{start_point} isn't a directory.")
        terminate_interaction 1
      end
    when /^-/ then
      alert_error clean_text("Invalid option: #{args.first}. See 'gem --help'.")
      terminate_interaction 1
    else
      invoke_command(args, build_args)
    end
  end

  def find_command(cmd_name)
    cmd_name = find_alias_command cmd_name

    possibilities = find_command_possibilities cmd_name

    if possibilities.size > 1
      raise Gem::CommandLineError,
            "Ambiguous command #{cmd_name} matches [#{possibilities.join(", ")}]"
    elsif possibilities.empty?
      raise Gem::UnknownCommandError.new(cmd_name)
    end

    self[possibilities.first]
  end

  def find_alias_command(cmd_name)
    alias_name = ALIAS_COMMANDS[cmd_name]
    alias_name ? alias_name : cmd_name
  end

  def find_command_possibilities(cmd_name)
    len = cmd_name.length

    found = command_names.select {|name| cmd_name == name[0, len] }

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/command_manager.rb:203 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/75f524e4d0fcb7e4. Report an issue: GitHub.