stanfordnlp/CoreNLP · error · IllegalArgumentException

Language does not support parsing!

Error message

Language <language> does not support parsing!

What it means

After resolving the language, Config.setProperties() checks that the chosen Language has a params object (which supplies the treebank language pack and other parsing settings). If language.params == null, the language is known but does not support the dependency-parsing configuration, so IllegalArgumentException is thrown.

Solutions

  1. Choose a language that supports parsing (check Config.getLanguage()'s Language enum for non-null params)
  2. Upgrade to a newer CoreNLP version where your language may have parsing params
  3. Use the default ('english') or a supported language like 'english', 'chinese', etc., or supply custom params

Example fix

// before
props.setProperty("language", "klingon"); // no parsing params
// after
props.setProperty("language", "english"); // supported language
Defensive patterns

Strategy: validation

Validate before calling

// check the language supports parsing before training
String lang = props.getProperty("language", "english");
if (!List.of("english","chinese","german","spanish","french").contains(lang)) {
  throw new IllegalArgumentException("Language may not support nndep parsing: " + lang);
}

Try / catch

try {
  DependencyParser parser = DependencyParser.train(props);
} catch (IllegalArgumentException e) {
  props.setProperty("language", "english");
  DependencyParser parser = DependencyParser.train(props);
}

Prevention

When it happens

Trigger: Setting `language` to a value whose Language enum entry has null params (a language entry that only supports other tasks, not parsing).

Common situations: Selecting an exotic/newer language in the nndep parser that lacks parsing params; using a language key copied from another CoreNLP tool where it exists but has no nndep params; version mismatch where the language exists but parsing params were only added later.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/parser/nndep/Config.java:263

    noPunc = PropertiesUtils.getBool(props, "noPunc", noPunc);
    doWordEmbeddingGradUpdate = PropertiesUtils.getBool(props, "doWordEmbeddingGradUpdate", doWordEmbeddingGradUpdate);

    // Runtime parsing options
    sentenceDelimiter = PropertiesUtils.getString(props, "sentenceDelimiter", sentenceDelimiter);
    tagger = PropertiesUtils.getString(props, "tagger.model", tagger);

    String escaperClass = props.getProperty("escaper");
    escaper = escaperClass != null ? ReflectionLoading.loadByReflection(escaperClass) : null;

    // Language options
    language = props.containsKey("language")
               ? getLanguage(props.getProperty("language"))
               : language;
    if (language == null) {
      throw new IllegalArgumentException("Unknown language " + props.containsKey("language"));
    }
    if (language.params == null) {
      throw new IllegalArgumentException("Language " + language + " does not support parsing!");
    }
    tlp = language.params.treebankLanguagePack();
    preTokenized = PropertiesUtils.getBool(props, "tokenized", preTokenized);

    // if a tlp was specified go with that
    String tlpCanonicalName = props.getProperty("tlp");
    if (tlpCanonicalName != null) {
      try {
        tlp = ReflectionLoading.loadByReflection(tlpCanonicalName);
        System.err.println("Loaded TreebankLanguagePack: "+tlpCanonicalName);
      } catch (Exception e) {
        System.err.println("Error: Failed to load TreebankLanguagePack: "+tlpCanonicalName);
      }
    }
  }

  /**
   * Get the {@link edu.stanford.nlp.international.Language}

View on GitHub (pinned to 1b7edd19c4)