{"record":{"id":"9654082832e5b1f9","repo":"stanfordnlp/CoreNLP","slug":"must-specify-output-with-output","errorCode":null,"errorMessage":"Must specify output with -output","messagePattern":"Must specify output with -output","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java","lineNumber":46,"sourceCode":"    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;\n      if (male * 0.5 > female + neutral && male > 2) {\n        gender = Gender.MALE;\n      } else if (female * 0.5 > male + neutral && female > 2) {\n        gender = Gender.FEMALE;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/util/ConvertGenderFile.java#L28-L64","documentation":"ConvertGenderFile.main validates that an output path was provided; if output is null after parsing, it throws this IllegalArgumentException. The converted gender map must be written somewhere via -output.","triggerScenarios":"Running ConvertGenderFile without the -output flag (or with -output missing its value).","commonSituations":"Forgot the -output flag while specifying -input; value omitted after -output; assumption that a default output file exists (it does not).","solutions":["Add -output <target-file> to the command line","Ensure a value follows the -output flag","Double-check flag spelling is exactly -output"],"exampleFix":"// before\njava ConvertGenderFile -input gender.counts\n// after\njava ConvertGenderFile -input gender.counts -output gender.ser","handlingStrategy":"validation","validationCode":"boolean hasOutput = false;\nfor (int i = 0; i < args.length - 1; i++) if (\"-output\".equalsIgnoreCase(args[i]) && args[i+1] != null) { hasOutput = true; break; }\nif (!hasOutput) throw new IllegalArgumentException(\"-output 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 -output with a target file path","Remember there is no default output file","Validate the full command in wrapper scripts before running"],"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"}