stanfordnlp/CoreNLP · error · java.lang.IllegalArgumentException

Unsupported minimizer

Error message

Unsupported minimizer ${MINIMIZER}

What it means

DVParser.executeOneTrainingBatch switches on the MINIMIZER constant to run the selected optimizer (e.g. SGD/AdaGrad variants); the default branch throws IllegalArgumentException for unsupported minimizer values. This is an internal configuration guard — MINIMIZER is a class-level constant not normally exposed as a CLI flag.

Solutions

  1. Set MINIMIZER to a value handled by the switch (e.g. the AdaGrad/SGD constant used in the release)
  2. Remove custom minimizer overrides and use the stock DVParser build
  3. If adding a new optimizer, extend the switch in executeOneTrainingBatch before training

Example fix

// before
private static final int MINIMIZER = 42; // unsupported
// after
private static final int MINIMIZER = DVParser.ADA_GRAD;
Defensive patterns

Strategy: validation

Validate before calling

// MINIMIZER is a source-level constant in DVParser
if (MINIMIZER != DVParser.ADA_GRAD /* and other supported constants */) {
    throw new IllegalArgumentException("MINIMIZER value not supported by executeOneTrainingBatch");
}

Try / catch

try {
    parser.train(trainTreebank, compTreebank);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Unsupported minimizer")) {
        System.err.println("Reset MINIMIZER to a value handled by the training switch");
    }
}

Prevention

When it happens

Trigger: A developer editing DVParser source sets MINIMIZER to a value not covered by the switch cases, then calls train, which invokes executeOneTrainingBatch during a training iteration.

Common situations: Custom builds of CoreNLP where someone added or changed the minimizer constant; code that programmatically modifies DVParser configuration; version drift where a chosen minimizer name no longer matches the switch.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/d1997f7e143c8b84. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/parser/dvparser/DVParser.java:296

      break;
    }
    case 3:{
      // AdaGrad
      double eps = 1e-3;
      double currCost = 0;
      for(int i = 0; i < op.trainOptions.qnIterationsPerBatch; i++){
        double[] gradf = gcFunc.derivativeAt(theta);
        currCost = gcFunc.valueAt(theta);
        log.info("batch cost: " + currCost);
        for (int feature =0; feature<gradf.length;feature++ ) {
          sumGradSquare[feature] = sumGradSquare[feature] + gradf[feature]*gradf[feature];
          theta[feature] = theta[feature] - (op.trainOptions.learningRate * gradf[feature]/(Math.sqrt(sumGradSquare[feature])+eps));
        }
      }
      break;
    }
    default: {
      throw new IllegalArgumentException("Unsupported minimizer " + MINIMIZER);
    }
    }


    dvModel.vectorToParams(theta);
  }

  public DVParser(DVModel model, LexicalizedParser parser) {
    this.parser = parser;
    this.op = parser.getOp();
    this.dvModel = model;
  }

  public DVParser(LexicalizedParser parser) {
    this.parser = parser;
    this.op = parser.getOp();

    if (op.trainOptions.randomSeed == 0) {

View on GitHub (pinned to 1b7edd19c4)