{"record":{"id":"c216562647c67606","repo":"stanfordnlp/CoreNLP","slug":"unknown-argument-args-argindex","errorCode":null,"errorMessage":"Unknown argument ${args[argIndex]}","messagePattern":"Unknown argument (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java","lineNumber":37,"sourceCode":" *\n * @author John Bauer\n */\npublic class ConvertGenderFile {\n\n  private ConvertGenderFile() {} // static class\n\n  public static void main(String[] args) throws IOException {\n    String input = null;\n    String output = null;\n    for (int argIndex = 0; argIndex < args.length; ) {\n      if (args[argIndex].equalsIgnoreCase(\"-input\")) {\n        input = args[argIndex + 1];\n        argIndex += 2;\n      } else if (args[argIndex].equalsIgnoreCase(\"-output\")) {\n        output = args[argIndex + 1];\n        argIndex += 2;\n      } else {\n        throw new IllegalArgumentException(\"Unknown argument \" + args[argIndex]);\n      }\n    }\n\n    if (input == null) {\n      throw new IllegalArgumentException(\"Must specify input with -input\");\n    }\n\n    if (output == null) {\n      throw new IllegalArgumentException(\"Must specify output with -output\");\n    }\n\n    Map<List<String>, Gender> genderNumber = Generics.newHashMap();\n\n    BufferedReader reader = IOUtils.readerFromString(input);\n    for (String line; (line = reader.readLine()) != null; ) {\n      String[] split = line.split(\"\\t\");\n      String[] countStr = split[1].split(\" \");\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java#L19-L55","documentation":"A command-line argument parse failure in the ConvertGenderFile static main tool: it only accepts -input and -output flags (each with a value); any other token on the command line triggers this IllegalArgumentException, indicating a typo or unsupported flag.","triggerScenarios":"Running java edu.stanford.nlp.dcoref.util.ConvertGenderFile with an argument other than -input/-output, e.g. misspelled flags or extra positional arguments.","commonSituations":"Typo like -in instead of -input; passing flags copied from another CoreNLP tool; adding a stray filename without a flag.","solutions":["Only pass -input <file> and -output <file> arguments","Fix any misspelled flags","Check the tool's usage/main source for the accepted flag set"],"exampleFix":"// before\njava ConvertGenderFile -in gender.txt -out gender.ser\n// after\njava ConvertGenderFile -input gender.txt -output gender.ser","handlingStrategy":"validation","validationCode":"List<String> allowed = Arrays.asList(\"-input\", \"-output\");\nfor (int i = 0; i < args.length; i += 2) {\n  if (!allowed.contains(args[i].toLowerCase())) throw new IllegalArgumentException(\"Unknown arg \" + args[i]);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ConvertGenderFile.main(args);\n} catch (IllegalArgumentException e) {\n  System.err.println(\"Usage: ConvertGenderFile -input <file> -output <file>\");\n}","preventionTips":["Only pass -input and -output flags to ConvertGenderFile","Keep each flag followed by exactly one value","Check the tool's main() for the accepted flag list","Avoid copy-pasting flag sets between different CoreNLP utilities"],"tags":["java","cli","illegalargumentexception","dcoref"],"backgroundTag":"invalid-cli-argument","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}