{"record":{"id":"e90339bb11962257","repo":"ruby/rubygems","slug":"please-specify-a-gem-name-on-the-command-line-e-g","errorCode":null,"errorMessage":"Please specify a gem name on the command line (e.g. gem build GEMNAME)","messagePattern":"Please specify a gem name on the command line \\(e\\.g\\. gem build GEMNAME\\)","errorType":"exception","errorClass":"Gem::CommandLineError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/command.rb","lineNumber":223,"sourceCode":"  end\n\n  def extract_gem_name_and_version(name) # :nodoc:\n    if /\\A(.*):(#{Gem::Requirement::PATTERN_RAW})\\z/ =~ name\n      [$1, $2]\n    else\n      [name]\n    end\n  end\n\n  ##\n  # Get a single gem name from the command line.  Fail if there is no gem name\n  # or if there is more than one gem name given.\n\n  def get_one_gem_name\n    args = options[:args]\n\n    if args.nil? || args.empty?\n      raise Gem::CommandLineError,\n            \"Please specify a gem name on the command line (e.g. gem build GEMNAME)\"\n    end\n\n    if args.size > 1\n      raise Gem::CommandLineError,\n            \"Too many gem names (#{args.join(\", \")}); please specify only one\"\n    end\n\n    args.first\n  end\n\n  ##\n  # Get a single optional argument from the command line.  If more than one\n  # argument is given, return only the first. Return nil if none are given.\n\n  def get_one_optional_argument\n    args = options[:args] || []\n    args.first","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/command.rb#L205-L241","documentation":"Error \"Please specify a gem name on the command line (e.g. gem build GEMNAME)\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/command.rb:223 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"}