{"record":{"id":"2d733a5e648bda07","repo":"stanfordnlp/CoreNLP","slug":"skipping","errorCode":null,"errorMessage":"Skipping ","messagePattern":"Skipping ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java","lineNumber":1290,"sourceCode":"      if (replaceExtension) {\n        int lastDot = outputFilename.lastIndexOf('.');\n        // for paths like \"./zzz\", lastDot will be 0\n        if (lastDot > 0) {\n          outputFilename = outputFilename.substring(0, lastDot);\n        }\n      }\n      // ensure we don't make filenames with doubled extensions like .xml.xml\n      if (!outputFilename.endsWith(extension)) {\n        outputFilename += extension;\n      }\n      // normalize filename for the upcoming comparison\n      outputFilename = new File(outputFilename).getCanonicalPath();\n\n      //--Conditions For Skipping The File\n      // TODO this could fail if there are softlinks, etc. -- need some sort of sameFile tester\n      //      Java 7 will have a Files.isSymbolicLink(file) method\n      if (outputFilename.equals(file.getCanonicalPath())) {\n        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.\");\n        totalSkipped.incValue(1);\n        continue;\n      }\n      if (noClobber && new File(outputFilename).exists()) {\n        logger.err(\"Skipping \" + file.getName() + \": output file \" + outputFilename + \" as it already exists.  Don't use the noClobber option to override this.\");\n        totalSkipped.incValue(1);\n        continue;\n      }\n\n      final String finalOutputFilename = outputFilename;\n\n      //register a task...\n      //catching exceptions...\n      try {\n        // Check whether this file should be skipped again\n        if (noClobber && new File(finalOutputFilename).exists()) {\n          logger.err(\"Skipping \" + file.getName() + \": output file \" + finalOutputFilename + \" as it already exists.  Don't use the noClobber option to override this.\");\n          synchronized (totalSkipped) {","sourceCodeStart":1272,"sourceCodeEnd":1308,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java#L1272-L1308","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set -outputDirectory to a different directory from the input files","Change -outputFormat or -extension so the output filename differs from the input","Rename input files to a distinct extension (e.g. .in.txt)","Check the printed skip list to confirm only unintended pairs are skipped"],"exampleFix":"// before\njava -cp corenlp.jar StanfordCoreNLP -filelist files.txt -outputFormat text\n// after\njava -cp corenlp.jar StanfordCoreNLP -filelist files.txt -outputFormat text -outputDirectory out/","handlingStrategy":"validation","validationCode":"File out = new File(outputDir, input.getName());\nif (out.getCanonicalPath().equals(input.getCanonicalPath())) {\n    throw new IllegalArgumentException(\"output path equals input path for \" + input);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set -outputDirectory to a directory distinct from inputs","Use an output format/extension that yields a different filename"],"tags":["cli","file-processing","skip","output-path"],"backgroundTag":"output-overwrite-guard","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"}