languagetool-org/languagetool · error · IOException
File not found or isn't a file: ${propFile.getAbsolutePath()
Error message
File not found or isn't a file: ${propFile.getAbsolutePath()} What it means
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.
Source
Thrown at languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/SentenceSourceChecker.java:54
/**
* Checks texts from one or more {@link SentenceSource}s.
* @since 2.4
*/
public class SentenceSourceChecker {
private SentenceSourceChecker() {
// 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"));View on GitHub (pinned to 2e990059ce)
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
Example fix
// before java ... -d ./config/ // after java ... -d /etc/languagetool/checker.properties
Defensive patterns
Strategy: validation
Validate before calling
File propFile = new File(value);
if (!propFile.exists() || propFile.isDirectory()) {
System.err.println("-d must be an existing file: " + propFile.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 the -d path: " + e.getMessage());
} else throw e;
} Prevention
- 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
When it happens
Trigger: Running with -d pointing to a non-existent file, a directory path, or a file deleted between shell expansion and execution.
Common situations: Relative path wrong because of working directory; copy-paste of a directory instead of a file path; config file renamed or moved after deployment.
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
- File not found or isn't a file: ${disabledRulesPropFile.getA
- No rules are active. Please make sure your rule ids (<option
- Not found:
- Parameter --config must be set and point to a property file
- Could not load properties from ''
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/cf6fc9961f36a08f.
Report an issue: GitHub.