languagetool-org/languagetool · error · RuntimeException
Could not create filter class using constructor ${constructo
Error message
Could not create filter class using constructor ${constructor} What it means
Instantiation failure inside RegexRuleFilterCreator.getFilter: the no-argument constructor of the filter class was found, but Constructor.newInstance() threw (for example the constructor itself failed or the class is abstract). The original exception is chained; the input at fault is the filter class referenced by the XML rule.
Source
Thrown at languagetool-core/src/main/java/org/languagetool/rules/patterns/RegexRuleFilterCreator.java:54
Class<?> aClass = JLanguageTool.getClassBroker().forName(className);
Constructor<?>[] constructors = aClass.getConstructors();
if (constructors.length != 1) {
throw new RuntimeException("Constructor of filter class '"
+ className + "' must have exactly one constructor, but it has " + constructors.length);
}
Constructor<?> constructor = constructors[0];
try {
if (constructor.getParameterTypes().length != 0) {
throw new RuntimeException("Constructor of filter class '" + className + "' must not have arguments: " + constructor);
}
Object filter = constructor.newInstance();
if (filter instanceof RegexRuleFilter) {
return (RegexRuleFilter) filter;
} else {
throw new RuntimeException("Filter class '" + className + "' must implement interface " + RegexRuleFilter.class.getSimpleName());
}
} catch (Exception e) {
throw new RuntimeException("Could not create filter class using constructor " + constructor, e);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException("Could not find filter class: '"
+ className + "' - make sure to use a fully qualified class name like 'org.languagetool.rules.MyFilter'");
}
}
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Check the chained cause to see why the constructor threw
- Ensure the filter class is concrete (not abstract) and its constructor performs no failing initialization
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/rules/patterns/RegexRuleFilterCreator.java:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/c764f7d29300a9ed.
Report an issue: GitHub.