{"record":{"id":"75f524e4d0fcb7e4","repo":"ruby/rubygems","slug":"ambiguous-command-cmd-name-matches-possibili","errorCode":null,"errorMessage":"Ambiguous command #{cmd_name} matches [#{possibilities.join(\", \")}]","messagePattern":"Ambiguous command #(.+?) matches \\[#(.+?)\\]","errorType":"exception","errorClass":"Gem::CommandLineError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/command_manager.rb","lineNumber":203,"sourceCode":"      else\n        alert_error clean_text(\"#{start_point} isn't a directory.\")\n        terminate_interaction 1\n      end\n    when /^-/ then\n      alert_error clean_text(\"Invalid option: #{args.first}. See 'gem --help'.\")\n      terminate_interaction 1\n    else\n      invoke_command(args, build_args)\n    end\n  end\n\n  def find_command(cmd_name)\n    cmd_name = find_alias_command cmd_name\n\n    possibilities = find_command_possibilities cmd_name\n\n    if possibilities.size > 1\n      raise Gem::CommandLineError,\n            \"Ambiguous command #{cmd_name} matches [#{possibilities.join(\", \")}]\"\n    elsif possibilities.empty?\n      raise Gem::UnknownCommandError.new(cmd_name)\n    end\n\n    self[possibilities.first]\n  end\n\n  def find_alias_command(cmd_name)\n    alias_name = ALIAS_COMMANDS[cmd_name]\n    alias_name ? alias_name : cmd_name\n  end\n\n  def find_command_possibilities(cmd_name)\n    len = cmd_name.length\n\n    found = command_names.select {|name| cmd_name == name[0, len] }\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/command_manager.rb#L185-L221","documentation":"Error \"Ambiguous command #{cmd_name} matches [#{possibilities.join(\", \")}]\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/command_manager.rb:203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}