{"record":{"id":"9c1f395a550727a1","repo":"stanfordnlp/CoreNLP","slug":"must-specify-input-with-input","errorCode":null,"errorMessage":"Must specify input with -input","messagePattern":"Must specify input with -input","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java","lineNumber":42,"sourceCode":"  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\n      int male = Integer.parseInt(countStr[0]);\n      int female = Integer.parseInt(countStr[1]);\n      int neutral = Integer.parseInt(countStr[2]);\n\n      Gender gender = Gender.UNKNOWN;","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java#L24-L60","documentation":"After argument parsing, ConvertGenderFile.main validates that an input path was provided; if input is still null it throws this IllegalArgumentException. The tool requires an explicit -input file of gender/number mappings.","triggerScenarios":"Running ConvertGenderFile without the -input flag (or with -input but no following value).","commonSituations":"Forgot the -input flag; provided only -output; flag followed by nothing because the value was omitted.","solutions":["Add -input <path-to-gender-file> to the command line","Ensure a value follows the -input flag","Verify the flag name is exactly -input"],"exampleFix":"// before\njava ConvertGenderFile -output gender.ser\n// after\njava ConvertGenderFile -input gender.counts -output gender.ser","handlingStrategy":"validation","validationCode":"boolean hasInput = false;\nfor (int i = 0; i < args.length - 1; i++) if (\"-input\".equalsIgnoreCase(args[i]) && args[i+1] != null) { hasInput = true; break; }\nif (!hasInput) throw new IllegalArgumentException(\"-input is required\");","typeGuard":null,"tryCatchPattern":"try {\n  ConvertGenderFile.main(args);\n} catch (IllegalArgumentException e) {\n  System.err.println(\"Usage: ConvertGenderFile -input <in> -output <out>\");\n  System.exit(2);\n}","preventionTips":["Always pass -input with a concrete file path","Wrap CLI invocations in scripts that assert required flags","Echo the usage line when arguments are missing"],"tags":["java","cli","missing-argument","dcoref"],"backgroundTag":"missing-required-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"}