{"record":{"id":"4f6e68b79b067b99","repo":"stanfordnlp/CoreNLP","slug":"unknown-minimizer-minimizer","errorCode":null,"errorMessage":"Unknown minimizer: {minimizer}","messagePattern":"Unknown minimizer: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/ie/KBPStatisticalExtractor.java","lineNumber":597,"sourceCode":"        factory.useHybridMinimizerWithInPlaceSGD(100, 1000, sigma);\n        minimizerFactory = () -> {\n          SGDMinimizer<DiffFunction> firstMinimizer = new SGDMinimizer<>(sigma, 50, 1000);\n          QNMinimizer secondMinimizer = new QNMinimizer(15);\n          return new HybridMinimizer(firstMinimizer, secondMinimizer, 50);\n        };\n        break;\n      case L1:\n        minimizerFactory = () -> {\n          try {\n            return MetaClass.create(\"edu.stanford.nlp.optimization.OWLQNMinimizer\").createInstance(sigma);\n          } catch (Exception e) {\n            log.err(\"Could not create l1 minimizer! Reverting to l2.\");\n            return new QNMinimizer(15);\n          }\n        };\n        break;\n      default:\n        throw new IllegalStateException(\"Unknown minimizer: \" + minimizer);\n    }\n    factory.setMinimizerCreator(minimizerFactory);\n    return factory;\n  }\n\n\n  /**\n   * Train a multinomial classifier off of the provided dataset.\n   * @param dataset The dataset to train the classifier off of.\n   * @return A classifier.\n   */\n  public static Classifier<String, String> trainMultinomialClassifier(\n      GeneralDataset<String, String> dataset,\n      int featureThreshold,\n      double sigma) {\n    // Set up the dataset and factory\n    log.info(\"Applying feature threshold (\" + featureThreshold + \")...\");\n    dataset.applyFeatureCountThreshold(featureThreshold);","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ie/KBPStatisticalExtractor.java#L579-L615","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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."],"exampleFix":"// before\nprops.setProperty(\"minimizer\", \"L2\");\n// after\nprops.setProperty(\"minimizer\", \"l2\");","handlingStrategy":"validation","validationCode":"String minimizer = props.getProperty(\"minimizer\");\nif (minimizer != null && !minimizer.equals(\"l1\") && !minimizer.equals(\"l2\")) {\n  throw new IllegalArgumentException(\"minimizer must be 'l1' or 'l2', got: \" + minimizer);\n}","typeGuard":null,"tryCatchPattern":"try {\n  factory = KBPStatisticalExtractor.factory(props);\n} catch (IllegalStateException e) {\n  log.warn(\"Falling back to default minimizer: \" + e.getMessage());\n  props.remove(\"minimizer\");\n  factory = KBPStatisticalExtractor.factory(props);\n}","preventionTips":["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."],"tags":["configuration","illegal-state","nlp","java"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}