languagetool-org/languagetool · error · IOException

File not found or isn't a file: ${disabledRulesPropFile.getA

Error message

File not found or isn't a file: ${disabledRulesPropFile.getAbsolutePath()}

What it means

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.

Source

Thrown at languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/SentenceSourceChecker.java:62

    // no public constructor
  }

  public static void main(String[] args) throws IOException {
    SentenceSourceChecker prg = new SentenceSourceChecker();
    CommandLine commandLine = ensureCorrectUsageOrExit(args);
    File propFile = null;
    if (commandLine.hasOption('d')) {
      propFile = new File(commandLine.getOptionValue('d'));
      if (!propFile.exists() || propFile.isDirectory()) {
        throw new IOException("File not found or isn't a file: " + propFile.getAbsolutePath());
      }
    }
    String languageCode = commandLine.getOptionValue('l');
    Set<String> disabledRuleIds = new HashSet<>();
    if (commandLine.hasOption("rule-properties")) {
      File disabledRulesPropFile = new File(commandLine.getOptionValue("rule-properties"));
      if (!disabledRulesPropFile.exists() || disabledRulesPropFile.isDirectory()) {
        throw new IOException("File not found or isn't a file: " + disabledRulesPropFile.getAbsolutePath());
      }
      Properties disabledRules = new Properties();
      try (FileInputStream stream = new FileInputStream(disabledRulesPropFile)) {
        disabledRules.load(stream);
        addDisabledRules("all", disabledRuleIds, disabledRules);
        addDisabledRules(languageCode, disabledRuleIds, disabledRules);
      }
    }
    String motherTongue = commandLine.getOptionValue('m');
    int maxArticles = Integer.parseInt(commandLine.getOptionValue("max-sentences", "0"));
    int maxErrors = Integer.parseInt(commandLine.getOptionValue("max-errors", "0"));
    int contextSize = Integer.parseInt(commandLine.getOptionValue("context-size", "50"));
    prg.run(propFile, disabledRuleIds, languageCode, motherTongue, maxArticles,
      maxErrors, contextSize,
      commandLine);
  }

  private static void addDisabledRules(String languageCode, Set<String> disabledRuleIds, Properties disabledRules) {

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Verify the path exists (ls) and is a regular file
  2. Correct the --rule-properties value or create the file
  3. Omit the option if you don't need rule disabling

Example fix

// before
java ... --rule-properties ./disabled/
// after
java ... --rule-properties ./disabled-rules.properties
Defensive patterns

Strategy: validation

Validate before calling

File rp = new File(rulePropsPath);
if (!rp.isFile()) { // isFile() covers both missing and directory
  System.err.println("--rule-properties must be an existing file: " + rp.getAbsolutePath());
  System.exit(2);
}

Try / catch

try {
  SentenceSourceChecker.main(args);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("File not found or isn't a file")) {
    System.err.println("Check --rule-properties path: " + e.getMessage());
  } else throw e;
}

Prevention

When it happens

Trigger: Passing --rule-properties with a path that doesn't exist or points at a directory.

Common situations: Stale path after reorganization; typo in filename; assuming a default file exists when none was shipped.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/cbd5df62bc4fc7ce. Report an issue: GitHub.