stanfordnlp/CoreNLP · error · IllegalStateException
Unknown minimizer
Error message
Unknown minimizer: {minimizer} What it means
KBPStatisticalExtractor.initFactory selects a qnMinimizer ('l1' or 'l2'); any other value hits the switch's default branch and throws IllegalStateException. This is a configuration check guarding the optimizer choice used when building the feature factory. The message includes the offending minimizer string.
Solutions
- Set the minimizer property to exactly 'l1' or 'l2' (lowercase) in the properties used to build the factory.
- Remove the minimizer property entirely to use the default branch behavior if unsure.
- Check the CoreNLP version's supported minimizer strings in KBPStatanicalExtractor source if upgrading from an older release.
Example fix
// before
props.setProperty("minimizer", "L2");
// after
props.setProperty("minimizer", "l2"); Defensive patterns
Strategy: validation
Validate before calling
String minimizer = props.getProperty("minimizer");
if (minimizer != null && !minimizer.equals("l1") && !minimizer.equals("l2")) {
throw new IllegalArgumentException("minimizer must be 'l1' or 'l2', got: " + minimizer);
} Try / catch
try {
factory = KBPStatisticalExtractor.factory(props);
} catch (IllegalStateException e) {
log.warn("Falling back to default minimizer: " + e.getMessage());
props.remove("minimizer");
factory = KBPStatisticalExtractor.factory(props);
} Prevention
- Only set 'minimizer' to 'l1' or 'l2' exactly, in lowercase.
- Keep training properties files versioned with the CoreNLP version you use.
- Log/echo effective props before training to catch typos early.
When it happens
Trigger: Calling initFactory/factory with a properties object whose 'minimizer' (qnMinimizer) key is set to something other than 'l1' or 'l2', e.g. a typo like 'L2', 'lbfgs', or 'l-2'.
Common situations: Copying training config from docs of another CoreNLP version, hand-editing props files with wrong case ('L1' vs 'l1'), or passing an optimizer name from a different ML library.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown clique: " + clique
- originalWords and sentence of different sizes…
- preTokenized option set: Non-standard annotators list…
- Unknown LogPriorType:
- unsupported language
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/4f6e68b79b067b99.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ie/KBPStatisticalExtractor.java:597
factory.useHybridMinimizerWithInPlaceSGD(100, 1000, sigma);
minimizerFactory = () -> {
SGDMinimizer<DiffFunction> firstMinimizer = new SGDMinimizer<>(sigma, 50, 1000);
QNMinimizer secondMinimizer = new QNMinimizer(15);
return new HybridMinimizer(firstMinimizer, secondMinimizer, 50);
};
break;
case L1:
minimizerFactory = () -> {
try {
return MetaClass.create("edu.stanford.nlp.optimization.OWLQNMinimizer").createInstance(sigma);
} catch (Exception e) {
log.err("Could not create l1 minimizer! Reverting to l2.");
return new QNMinimizer(15);
}
};
break;
default:
throw new IllegalStateException("Unknown minimizer: " + minimizer);
}
factory.setMinimizerCreator(minimizerFactory);
return factory;
}
/**
* Train a multinomial classifier off of the provided dataset.
* @param dataset The dataset to train the classifier off of.
* @return A classifier.
*/
public static Classifier<String, String> trainMultinomialClassifier(
GeneralDataset<String, String> dataset,
int featureThreshold,
double sigma) {
// Set up the dataset and factory
log.info("Applying feature threshold (" + featureThreshold + ")...");
dataset.applyFeatureCountThreshold(featureThreshold);View on GitHub (pinned to 1b7edd19c4)