{"record":{"id":"b3789a064d267ab6","repo":"stanfordnlp/CoreNLP","slug":"no-input-file-provided-use-textfile","errorCode":null,"errorMessage":"No input file provided (use -textFile)","messagePattern":"No input file provided \\(use -textFile\\)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"critical","filePath":"src/edu/stanford/nlp/parser/nndep/DependencyParser.java","lineNumber":1320,"sourceCode":"      parser.testCoNLL(props.getProperty(\"testFile\"), props.getProperty(\"outFile\"));\n    }\n\n    // Parse raw text data\n    if (props.containsKey(\"textFile\")) {\n      if (!loaded) {\n        parser.loadModelFile(props.getProperty(\"model\"));\n        loaded = true;\n      }\n\n      String encoding = parser.config.tlp.getEncoding();\n      String inputFilename = props.getProperty(\"textFile\");\n      BufferedReader input;\n      try {\n        input = inputFilename.equals(\"-\")\n                ? IOUtils.readerFromStdin(encoding)\n                : IOUtils.readerFromString(inputFilename, encoding);\n      } catch (IOException e) {\n        throw new RuntimeIOException(\"No input file provided (use -textFile)\", e);\n      }\n\n      String outputFilename = props.getProperty(\"outFile\");\n      PrintWriter output;\n      try {\n        output = outputFilename == null || outputFilename.equals(\"-\")\n            ? IOUtils.encodedOutputStreamPrintWriter(System.out, encoding, true)\n            : IOUtils.getPrintWriter(outputFilename, encoding);\n      } catch (IOException e) {\n        throw new RuntimeIOException(\"Error opening output file\", e);\n      }\n\n      parser.parseTextFile(input, output);\n    }\n  }\n\n}\n","sourceCodeStart":1302,"sourceCodeEnd":1338,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/nndep/DependencyParser.java#L1302-L1338","documentation":"DependencyParser.test() wraps any IOException that occurs while opening the -textFile input source (file or stdin) in a RuntimeIOException with this message. The parser needs a readable text input to parse; if the file cannot be opened (missing, unreadable, bad path) the whole test run is aborted. The '(use -textFile)' hint points at the CLI flag that supplies the input.","triggerScenarios":"Running the parser test path with props 'testFile'/'textFile' pointing to a nonexistent path, a directory, or a file the process cannot read; also any IO error while opening stdin when inputFilename is \"-\".","commonSituations":"Typos in the -textFile path, running from a different working directory than expected, missing read permissions, or forgeting to specify -textFile at all so the default \"-\"/empty path fails.","solutions":["Verify the -textFile path exists and is readable (ls -l) before running the parser.","Run with an absolute path to eliminate working-directory confusion.","Check file permissions / that it is a regular file, not a directory.","Ensure the encoding matches the file's actual charset to avoid decode-time IO errors."],"exampleFix":"// before\njava -cp stanford-corenlp.jar edu.stanford.nlp.parser.nndep.DependencyParser -textFile input.tx\n// after\njava -cp stanford-corenlp.jar edu.stanford.nlp.parser.nndep.DependencyParser -textFile /abs/path/input.txt","handlingStrategy":"validation","validationCode":"java.io.File f = new java.io.File(textFilePath);\nif (textFilePath == null || (!textFilePath.equals(\"-\") && (!f.isFile() || !f.canRead())))\n    throw new IllegalArgumentException(\"Input text file missing or unreadable: \" + textFilePath);","typeGuard":null,"tryCatchPattern":"try {\n    parser.test(argsToProps, \"-textFile\", path);\n} catch (RuntimeIOException e) {\n    // check cause: input file open failure\n}","preventionTips":["Resolve -textFile to an absolute path before invoking the parser.","Check File.isFile() && canRead() in a preflight step.","Remember \"-\" means stdin; pipe input explicitly when using it."],"tags":["java","io","file-not-found","nlp"],"backgroundTag":"file-not-found","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"}