{"record":{"id":"cbd5df62bc4fc7ce","repo":"languagetool-org/languagetool","slug":"file-not-found-or-isn-t-a-file-disabledrulespro","errorCode":null,"errorMessage":"File not found or isn't a file: ${disabledRulesPropFile.getAbsolutePath()}","messagePattern":"File not found or isn't a file: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/SentenceSourceChecker.java","lineNumber":62,"sourceCode":"    // no public constructor\n  }\n\n  public static void main(String[] args) throws IOException {\n    SentenceSourceChecker prg = new SentenceSourceChecker();\n    CommandLine commandLine = ensureCorrectUsageOrExit(args);\n    File propFile = null;\n    if (commandLine.hasOption('d')) {\n      propFile = new File(commandLine.getOptionValue('d'));\n      if (!propFile.exists() || propFile.isDirectory()) {\n        throw new IOException(\"File not found or isn't a file: \" + propFile.getAbsolutePath());\n      }\n    }\n    String languageCode = commandLine.getOptionValue('l');\n    Set<String> disabledRuleIds = new HashSet<>();\n    if (commandLine.hasOption(\"rule-properties\")) {\n      File disabledRulesPropFile = new File(commandLine.getOptionValue(\"rule-properties\"));\n      if (!disabledRulesPropFile.exists() || disabledRulesPropFile.isDirectory()) {\n        throw new IOException(\"File not found or isn't a file: \" + disabledRulesPropFile.getAbsolutePath());\n      }\n      Properties disabledRules = new Properties();\n      try (FileInputStream stream = new FileInputStream(disabledRulesPropFile)) {\n        disabledRules.load(stream);\n        addDisabledRules(\"all\", disabledRuleIds, disabledRules);\n        addDisabledRules(languageCode, disabledRuleIds, disabledRules);\n      }\n    }\n    String motherTongue = commandLine.getOptionValue('m');\n    int maxArticles = Integer.parseInt(commandLine.getOptionValue(\"max-sentences\", \"0\"));\n    int maxErrors = Integer.parseInt(commandLine.getOptionValue(\"max-errors\", \"0\"));\n    int contextSize = Integer.parseInt(commandLine.getOptionValue(\"context-size\", \"50\"));\n    prg.run(propFile, disabledRuleIds, languageCode, motherTongue, maxArticles,\n      maxErrors, contextSize,\n      commandLine);\n  }\n\n  private static void addDisabledRules(String languageCode, Set<String> disabledRuleIds, Properties disabledRules) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/SentenceSourceChecker.java#L44-L80","documentation":"SentenceSourceChecker.main also accepts a rule-properties option; when given, it validates the path the same way as -d and throws an IOException if the file does not exist or is a directory. This happens before rule properties are loaded to disable rules.","triggerScenarios":"Passing --rule-properties with a path that doesn't exist or points at a directory.","commonSituations":"Stale path after reorganization; typo in filename; assuming a default file exists when none was shipped.","solutions":["Verify the path exists (ls) and is a regular file","Correct the --rule-properties value or create the file","Omit the option if you don't need rule disabling"],"exampleFix":"// before\njava ... --rule-properties ./disabled/\n// after\njava ... --rule-properties ./disabled-rules.properties","handlingStrategy":"validation","validationCode":"File rp = new File(rulePropsPath);\nif (!rp.isFile()) { // isFile() covers both missing and directory\n  System.err.println(\"--rule-properties must be an existing file: \" + rp.getAbsolutePath());\n  System.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  SentenceSourceChecker.main(args);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"File not found or isn't a file\")) {\n    System.err.println(\"Check --rule-properties path: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Create the rules properties file before first run if needed","Omit the option when not needed","Use absolute paths","test -f in shell wrappers"],"tags":["cli","file-not-found","configuration"],"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"}