{"record":{"id":"62fccbe99bbdb9b0","repo":"stanfordnlp/CoreNLP","slug":"please-specify-either-file-filelist-or-stdin","errorCode":null,"errorMessage":"Please specify either -file, -fileList or -stdin","messagePattern":"Please specify either -file, -fileList or -stdin","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/sentiment/SentimentPipeline.java","lineNumber":339,"sourceCode":"      pipelineProps.setProperty(\"parse.buildgraphs\", \"false\");\n      pipelineProps.setProperty(\"enforceRequirements\", \"false\");\n      tokenizerProps = new Properties();\n      tokenizerProps.setProperty(\"annotators\", \"tokenize, ssplit\");\n    }\n\n    if (stdin && tokenizerProps != null) {\n      tokenizerProps.setProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, \"true\");\n    }\n\n    int count = 0;\n    if (filename != null) count++;\n    if (fileList != null) count++;\n    if (stdin) count++;\n    if (count > 1) {\n      throw new IllegalArgumentException(\"Please only specify one of -file, -fileList or -stdin\");\n    }\n    if (count == 0) {\n      throw new IllegalArgumentException(\"Please specify either -file, -fileList or -stdin\");\n    }\n\n    StanfordCoreNLP tokenizer = (tokenizerProps == null) ? null : new StanfordCoreNLP(tokenizerProps);\n    StanfordCoreNLP pipeline = new StanfordCoreNLP(pipelineProps);\n\n    if (filename != null) {\n      // Process a file.  The pipeline will do tokenization, which\n      // means it will split it into sentences as best as possible\n      // with the tokenizer.\n      List<Annotation> annotations = getAnnotations(tokenizer, inputFormat, filename, filterUnknown);\n      for (Annotation annotation : annotations) {\n        pipeline.annotate(annotation);\n\n        for (CoreMap sentence : annotation.get(CoreAnnotations.SentencesAnnotation.class)) {\n          System.out.println(sentence);\n          outputTree(System.out, sentence, outputFormats);\n        }\n      }","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/sentiment/SentimentPipeline.java#L321-L357","documentation":"SentimentPipeline's main() requires exactly one input source: -file, -fileList, or -stdin. The library throws this IllegalArgumentException when the count of provided input-source options is zero, i.e. the user gave no way to obtain the text to annotate.","triggerScenarios":"Running java edu.stanford.nlp.sentiment.SentimentPipeline with none of -file, -fileList, or -stdin on the command line (count==0 in main at SentimentPipeline.java:339).","commonSituations":"Users forget the input flag entirely, mis-spell it (e.g. -File, --file), or pass options via a properties file assuming input is configured there when it must be a CLI flag.","solutions":["Add exactly one of -file <path>, -fileList <file-of-paths>, or -stdin to the command line.","Check flag spelling/case: options are matched exactly (-file, -fileList, -stdin).","If piping input, remember -stdin must be explicitly given; the tool never defaults to stdin."],"exampleFix":"// before\njava edu.stanford.nlp.sentiment.SentimentPipeline -model model.ser.gz\n// after\njava edu.stanford.nlp.sentiment.SentimentPipeline -model model.ser.gz -file input.txt","handlingStrategy":"validation","validationCode":"// Java: validate args before invoking SentimentPipeline.main\nSet<String> provided = new HashSet<>(Arrays.asList(args));\nlong count = (provided.contains(\"-file\")?1:0)+(provided.contains(\"-fileList\")?1:0)+(provided.contains(\"-stdin\")?1:0);\nif (count == 0) throw new IllegalArgumentException(\"provide exactly one of -file, -fileList, -stdin\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one input-source flag to SentimentPipeline.","Keep the pipeline command line in a script so flags aren't dropped.","Check spelling of flags exactly as documented."],"tags":["java","cli","stanford-corenlp","sentiment"],"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-15T23:17:13.987Z"}