{"record":{"id":"23024f6fe50f2b4d","repo":"stanfordnlp/CoreNLP","slug":"must-specify-input-file-with-input","errorCode":null,"errorMessage":"Must specify input file with -input","messagePattern":"Must specify input file with -input","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/sentiment/BuildBinarizedDataset.java","lineNumber":186,"sourceCode":"\n    for (int argIndex = 0; argIndex < args.length; ) {\n      if (args[argIndex].equalsIgnoreCase(\"-input\")) {\n        inputPath = args[argIndex + 1];\n        argIndex += 2;\n      } else if (args[argIndex].equalsIgnoreCase(\"-parserModel\")) {\n        parserModel = args[argIndex + 1];\n        argIndex += 2;\n      } else if (args[argIndex].equalsIgnoreCase(\"-sentimentModel\")) {\n        sentimentModelPath = args[argIndex + 1];\n        argIndex += 2;\n      } else {\n        log.info(\"Unknown argument \" + args[argIndex]);\n        System.exit(2);\n      }\n    }\n\n    if (inputPath == null) {\n      throw new IllegalArgumentException(\"Must specify input file with -input\");\n    }\n\n    LexicalizedParser parser = LexicalizedParser.loadModel(parserModel);\n    TreeBinarizer binarizer = TreeBinarizer.simpleTreeBinarizer(parser.getTLPParams().headFinder(), parser.treebankLanguagePack());\n\n    if (sentimentModelPath != null) {\n      sentimentModel = SentimentModel.loadSerialized(sentimentModelPath);\n    }\n\n    String text = IOUtils.slurpFileNoExceptions(inputPath);\n    String[] chunks = text.split(\"\\\\n\\\\s*\\\\n+\"); // need blank line to make a new chunk\n\n    for (String chunk : chunks) {\n      if (chunk.trim().isEmpty()) {\n        continue;\n      }\n      // The expected format is that line 0 will be the text of the\n      // sentence, and each subsequence line, if any, will be a value","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/sentiment/BuildBinarizedDataset.java#L168-L204","documentation":"BuildBinarizedDataset.main requires an -input argument naming the file of label+phrase lines to binarize. If inputPath is null after argument parsing, it throws IllegalArgumentException immediately, before loading the parser model.","triggerScenarios":"Running BuildBinarizedDataset without -input <path>, or misspelling the flag so it hits the 'Unknown argument' branch and never sets inputPath.","commonSituations":"Batch scripts where the input path variable is unset; mixing up -input with other flags like -parserModel; omitted flags when adapting example commands.","solutions":["Pass -input <file> on the command line","Verify flag spelling and that the path variable in your script is non-empty","Check argument order/quotes so the value is attached to the right flag"],"exampleFix":"// before\njava BuildBinarizedDataset -parserModel model.gz\n// after\njava BuildBinarizedDataset -parserModel model.gz -input phrases.txt","handlingStrategy":"validation","validationCode":"if (args == null || Arrays.stream(args).noneMatch(a -> a.equals(\"-input\"))) {\n  throw new IllegalArgumentException(\"-input is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  BuildBinarizedDataset.main(args);\n} catch (IllegalArgumentException e) {\n  log.error(\"Usage: BuildBinarizedDataset -input <file> ...\");\n}","preventionTips":["Assert required flags in wrapper scripts","Verify flag spelling against the argument-parsing loop","Check input path variables are set before launching"],"tags":["cli","sentiment","arguments"],"backgroundTag":"missing-required-flag","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}