{"record":{"id":"6ac72ce3f9b912ff","repo":"languagetool-org/languagetool","slug":"not-found-make-sure-files-are-names-old-and","errorCode":null,"errorMessage":" not found - make sure files are names *.old and *.new in multi-file mode","messagePattern":" not found - make sure files are names \\*\\.old and \\*\\.new in multi-file mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/diff/RuleMatchDiffFinder.java","lineNumber":665,"sourceCode":"      if (args.length != 4) {\n        printUsageAndExit();\n      }\n      System.out.println(\"Running in multi-file mode, replacing 'XX' in filenames with lang codes...\");\n      String file1 = args[0];\n      String file3 = args[2];\n      String date = args[3];\n      File dir = new File(file1).getParentFile();\n      String templateName = new File(file1).getName();\n      int varPos = templateName.indexOf(\"XX\");\n      for (String file : dir.list()) {\n        if (file.length() >= varPos + 1) {\n          StringBuilder tempName = new StringBuilder(file).replace(varPos, varPos + 2, \"XX\");\n          if (tempName.toString().equals(templateName)) {\n            String langCode = file.substring(varPos, varPos + 2);\n            String tempNameNew = file.replace(\".old\", \".new\");\n            File newFile = new File(dir, tempNameNew);\n            if (!newFile.exists()) {\n              throw new RuntimeException(tempNameNew + \" not found - make sure files are names *.old and *.new in multi-file mode\");\n            }\n            System.out.println(\"==== \" + file + \" =================================\");\n            File oldFile = new File(dir, file);\n            String outputDir = file3.replace(\"XX\", langCode);\n            diffFinder.run(parser, oldFile, newFile, new File(outputDir), langCode, date);\n          }\n        }\n      }\n    } else {\n      if (args.length != 5) {\n        System.out.println(\"Usage: \" + RuleMatchDiffFinder.class.getSimpleName() + \" <matches1> <matches2> <resultDir> <langCode> <date>\");\n        System.out.println(\" <matches1> and <matches2> are text outputs of different versions of org.languagetool.dev.dumpcheck.SentenceSourceChecker run on the same input\");\n        System.out.println(\"                           or JSON outputs from org.languagetool.dev.httpchecker.HttpApiSentenceChecker\");\n        System.exit(1);\n      }\n      File file1 = new File(args[0]);\n      File file2 = new File(args[1]);\n      File outputDir = new File(args[2]);","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/diff/RuleMatchDiffFinder.java#L647-L683","documentation":"RuleMatchDiffFinder's multi-file mode expects input files in *.old/*.new pairs that differ only in a two-character language-code placeholder (XX). When, after locating a matching .old file, the corresponding .new file does not exist in the same directory, main() throws this RuntimeException naming the expected .new path.","triggerScenarios":"Running the diff finder in multi-file mode (directory of files whose names contain the 'XX' language placeholder) where a file 'foo.old' exists but 'foo.new' is missing, or the .new file was named differently (e.g. '.diff', wrong extension, different case).","commonSituations":"Forgot to copy/rename one side of a before/after diff pair; partial checkout or cleanup removed *.new files; files renamed so the '.old'/'.new' suffix convention broke.","solutions":["Create or restore the missing .new file at the exact path printed in the message","Ensure both files use the exact *.old and *.new suffixes in the same directory and share the name template with XX placeholders","Re-run after renaming, e.g. mv mismatched.new.ext proper-name.new","If single-language, use the two-file mode (oldFile newFile resultDir langCode date) instead of multi-file mode"],"exampleFix":"// before\nmv results-de.old.txt results-de.new.txt   # wrong name template\n// after\nmv results-XX.old.txt results-XX.new.txt   # or exactly matching de.old/de.new pair","handlingStrategy":"validation","validationCode":"File dir = new File(args[0]);\nfor (File f : dir.listFiles((d, n) -> n.endsWith(\".old\"))) {\n  File newF = new File(dir, f.getName().replace(\".old\", \".new\"));\n  if (!newF.isFile()) throw new IllegalStateException(\"missing pair: \" + newF);\n}","typeGuard":"static boolean isCompleteOldNewPair(File oldFile) {\n  return oldFile.isFile() && new File(oldFile.getParentFile(),\n    oldFile.getName().replace(\".old\", \".new\")).isFile();\n}","tryCatchPattern":"try {\n  diffFinderMain(args);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"*.old and *.new\")) {\n    System.err.println(\"fix file pair: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Always create .old/.new files together in the same directory","Use the exact XX language-code template in multi-file names","Script the pair creation so one side cannot be forgotten"],"tags":["java","file-not-found","diff-tooling"],"backgroundTag":"file-not-found","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}