{"record":{"id":"cf6fc9961f36a08f","repo":"languagetool-org/languagetool","slug":"file-not-found-or-isn-t-a-file-propfile-getabso","errorCode":null,"errorMessage":"File not found or isn't a file: ${propFile.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":54,"sourceCode":"\n/**\n * Checks texts from one or more {@link SentenceSource}s.\n * @since 2.4\n */\npublic class SentenceSourceChecker {\n\n  private SentenceSourceChecker() {\n    // 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\"));","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/SentenceSourceChecker.java#L36-L72","documentation":"SentenceSourceChecker.main validates the optional -d (properties file) command-line option: if the path does not exist or is a directory it throws an IOException with the absolute path. It is an eager fail-fast check before any processing starts.","triggerScenarios":"Running with -d pointing to a non-existent file, a directory path, or a file deleted between shell expansion and execution.","commonSituations":"Relative path wrong because of working directory; copy-paste of a directory instead of a file path; config file renamed or moved after deployment.","solutions":["Check the path printed in the message: confirm the file exists with ls","Point -d at an actual file, not a directory","Use an absolute path or verify the current working directory"],"exampleFix":"// before\njava ... -d ./config/\n// after\njava ... -d /etc/languagetool/checker.properties","handlingStrategy":"validation","validationCode":"File propFile = new File(value);\nif (!propFile.exists() || propFile.isDirectory()) {\n  System.err.println(\"-d must be an existing file: \" + propFile.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 the -d path: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Use absolute paths in scripts","test -f \"$FILE\" in shell wrappers before invoking","Avoid passing directories as file options","Keep config files in stable, documented locations"],"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-14T05:17:10.506Z"}