stanfordnlp/CoreNLP · error · RuntimeException

unknown language: " + language

Error message

unknown language: " + language

What it means

RuntimeException from TTags when initializing closed-class tag lists for a language name that matches none of the built-in language tables (english, french, german, spanish, chinese, testing, empty, etc.); the tagger cannot select POS tag inventories for that language.

Solutions

  1. Pass a supported -lang value (e.g., english) or omit it for the default
  2. Add a closed-class list for the language if extending the tagger
  3. Check spelling of the language option
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/edu/stanford/nlp/tagger/maxent/TTags.java:281 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/edu/stanford/nlp/tagger/maxent/TTags.java:281

      closed.add("DB");
      closed.add("GE");
      closed.add("PND");
      closed.add("PNG");
      closed.add("TO");
      closed.add(Tagger.EOS_TAG);
      closed.add("-LRB-");
      closed.add("-RRB-");
      isEnglish = false;
    } else if (language.equalsIgnoreCase("testing")) {
      closed.add(".");
      closed.add(Tagger.EOS_TAG);
      isEnglish = false;
    } else if (language.equalsIgnoreCase("")) {
      isEnglish = false;
    }
    /* add closed-class lists for other languages here */
    else {
      throw new RuntimeException("unknown language: " + language);
    }
  }


  /** Return the Set of tags used by this tagger (available after training the tagger).
   *
   * @return The Set of tags used by this tagger
   */
  public Set<String> tagSet() {
    return new HashSet<>(index.objectsList());
  }


  /**
   * Returns a list of all open class tags
   * @return set of open tags
   */
  public synchronized Set<String> getOpenTags() {

View on GitHub (pinned to 1b7edd19c4)