stanfordnlp/CoreNLP · warning

Skipping

Error message

Skipping 

What it means

StanfordCoreNLP batch mode skips a file when its computed output filename is identical to the input file's canonical path, to avoid overwriting the source document. It logs this message (with an explanatory suffix) and increments the skip counter.

Solutions

  1. Set -outputDirectory to a different directory from the input files
  2. Change -outputFormat or -extension so the output filename differs from the input
  3. Rename input files to a distinct extension (e.g. .in.txt)
  4. Check the printed skip list to confirm only unintended pairs are skipped

Example fix

// before
java -cp corenlp.jar StanfordCoreNLP -filelist files.txt -outputFormat text
// after
java -cp corenlp.jar StanfordCoreNLP -filelist files.txt -outputFormat text -outputDirectory out/
Defensive patterns

Strategy: validation

Validate before calling

File out = new File(outputDir, input.getName());
if (out.getCanonicalPath().equals(input.getCanonicalPath())) {
    throw new IllegalArgumentException("output path equals input path for " + input);
}

Prevention

When it happens

Trigger: Running StanfordCoreNLP -outputDirectory pointing at the same directory as the input files with an output extension/format that resolves to the same filename (e.g. input 'doc.txt' and output 'doc.txt' via fileExtension/format collision); StanfordCoreNLP main file-processing loop.

Common situations: Forgetting -outputDirectory so output lands beside the input; using -outputFormat text with extension settings that mirror the input extension; running twice with in-place conventions.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/2d733a5e648bda07. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java:1290

      if (replaceExtension) {
        int lastDot = outputFilename.lastIndexOf('.');
        // for paths like "./zzz", lastDot will be 0
        if (lastDot > 0) {
          outputFilename = outputFilename.substring(0, lastDot);
        }
      }
      // ensure we don't make filenames with doubled extensions like .xml.xml
      if (!outputFilename.endsWith(extension)) {
        outputFilename += extension;
      }
      // normalize filename for the upcoming comparison
      outputFilename = new File(outputFilename).getCanonicalPath();

      //--Conditions For Skipping The File
      // TODO this could fail if there are softlinks, etc. -- need some sort of sameFile tester
      //      Java 7 will have a Files.isSymbolicLink(file) method
      if (outputFilename.equals(file.getCanonicalPath())) {
        logger.err("Skipping " + file.getName() + ": output file " + outputFilename + " has the same filename as the input file -- assuming you don't actually want to do this.");
        totalSkipped.incValue(1);
        continue;
      }
      if (noClobber && new File(outputFilename).exists()) {
        logger.err("Skipping " + file.getName() + ": output file " + outputFilename + " as it already exists.  Don't use the noClobber option to override this.");
        totalSkipped.incValue(1);
        continue;
      }

      final String finalOutputFilename = outputFilename;

      //register a task...
      //catching exceptions...
      try {
        // Check whether this file should be skipped again
        if (noClobber && new File(finalOutputFilename).exists()) {
          logger.err("Skipping " + file.getName() + ": output file " + finalOutputFilename + " as it already exists.  Don't use the noClobber option to override this.");
          synchronized (totalSkipped) {

View on GitHub (pinned to 1b7edd19c4)