stanfordnlp/CoreNLP · error · RuntimeException

Unknown parser type: " + parserType + " (currently…

Error message

Unknown parser type: " + parserType + " (currently supported: stanford and charniak)

What it means

A configuration error in AnnotatorImplementations.parse: the parse.type property is neither 'stanford' nor 'charniak' (case-insensitive), so no parser implementation can be selected for the ParserAnnotator.

Solutions

  1. Set parse.type=stanford (default) or parse.type=charniak
  2. Fix typos — matching is equalsIgnoreCase but the string must still match exactly one of the two
  3. If you need another parser (e.g. bllip), use the custom annotator mechanism or a newer CoreNLP release that supports it
  4. Remove the parse.type property entirely to get the default Stanford parser

Example fix

// before
props.setProperty("parse.type", "standford");
// after
props.setProperty("parse.type", "stanford");
Defensive patterns

Strategy: validation

Validate before calling

String t = props.getProperty("parse.type", "stanford");
if (!t.equalsIgnoreCase("stanford") && !t.equalsIgnoreCase("charniak"))
  throw new IllegalArgumentException("parse.type must be stanford or charniak: " + t);

Try / catch

try {
  buildPipeline(props);
} catch (RuntimeException e) {
  if (e.getMessage().startsWith("Unknown parser type")) {
    log.error("Use parse.type=stanford or charniak");
  } else throw e;
}

Prevention

When it happens

Trigger: Setting parse.type to an unsupported string, e.g. parse.type=bllip, parse.type=charniak-johnson, or a typo like parse.type=standford.

Common situations: Configuring a third-party parser type in a CoreNLP version that only supports stanford/charniak, typos, copying configs from tutorials for other parser integrations.

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


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/AnnotatorImplementations.java:149

    String parserType = properties.getProperty("parse.type", "stanford");
    String maxLenStr = properties.getProperty("parse.maxlen");

    if (parserType.equalsIgnoreCase("stanford")) {
      return new ParserAnnotator("parse", properties);
    } else if (parserType.equalsIgnoreCase("charniak")) {
      String model = properties.getProperty("parse.model");
      String parserExecutable = properties.getProperty("parse.executable");
      if (model == null || parserExecutable == null) {
        throw new RuntimeException("Both parse.model and parse.executable properties must be specified if parse.type=charniak");
      }
      int maxLen = 399;
      if (maxLenStr != null) {
        maxLen = Integer.parseInt(maxLenStr);
      }

      return new CharniakParserAnnotator(model, parserExecutable, false, maxLen);
    } else {
      throw new RuntimeException("Unknown parser type: " + parserType + " (currently supported: stanford and charniak)");
    }
  }

  public Annotator custom(Properties properties, String property) {
    String customName = property;
    String customClassName = properties.getProperty(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX + property);
    if (property.startsWith(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX)) {
      customName = property.substring(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX.length());
      customClassName = properties.getProperty(property);
    }

    try {
      // name + properties
      return new MetaClass(customClassName).createInstance(customName, properties);
    } catch (MetaClass.ConstructorNotFoundException e) {
      try {
        // name
        return new MetaClass(customClassName).createInstance(customName);

View on GitHub (pinned to 1b7edd19c4)