stanfordnlp/CoreNLP · error · RuntimeException

unsupported language

Error message

unsupported language

What it means

HybridCorefProperties.getLanguage maps the coref language property to a java.util.Locale but only recognizes "en"/"english" and "zh"/"chinese". Any other value causes a RuntimeException("unsupported language"), since the hybrid coref system only ships models for these two languages.

Solutions

  1. Set the language property to "en" or "zh" (case-insensitive), the only supported values
  2. If another language is needed, use a different coref implementation or train your own models and extend getLanguage
  3. Check for typos/extra locale suffixes — use exactly "en", "english", "zh", or "chinese"
  4. Remove the language override so the default "en" is used

Example fix

// before
props.setProperty("coref.language", "french");
// after
props.setProperty("coref.language", "en"); // or "zh"
Defensive patterns

Strategy: validation

Validate before calling

String lang = props.getProperty("coref.language", "en").toLowerCase();
if (!lang.equals("en") && !lang.equals("english") && !lang.equals("zh") && !lang.equals("chinese")) throw new IllegalStateException("coref.language must be en or zh, got: " + lang);

Try / catch

try { Locale l = HybridCorefProperties.getLanguage(props); } catch (RuntimeException e) { props.setProperty("coref.language", "en"); // fall back or rethrow with message }

Prevention

When it happens

Trigger: Setting the coref language property (e.g. -coref.language or the LANG_PROP key) to a value other than en/english/zh/chinese, such as "es", "french", or "de", then running the hybrid coref pipeline.

Common situations: Copying a pipeline config from a multi-language Stanford CoreNLP setup and assuming hybrid coref supports the same language list; typos like "EN-US" or "eng"; switching a project to a language whose models were never released.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/coref/hybrid/HybridCorefProperties.java:133

  public static boolean doScore(Properties props) {
    return PropertiesUtils.getBool(props, SCORE_PROP, false);
  }
  public static boolean checkTime(Properties props) {
    return PropertiesUtils.getBool(props, TIMER_PROP, false);
  }
  public static boolean checkMemory(Properties props) {
    return PropertiesUtils.getBool(props, MEMORY_PROP, false);
  }

  public static int getThreadCounts(Properties props) {
    return PropertiesUtils.getInt(props, THREADS_PROP, Runtime.getRuntime().availableProcessors());
  }
  public static Locale getLanguage(Properties props) {
    String lang = PropertiesUtils.getString(props, LANG_PROP, "en");
    if(lang.equalsIgnoreCase("en") || lang.equalsIgnoreCase("english")) return Locale.ENGLISH;
    else if(lang.equalsIgnoreCase("zh") || lang.equalsIgnoreCase("chinese")) return Locale.CHINESE;
    else throw new RuntimeException("unsupported language");
  }
  public static boolean printMDLog(Properties props) {
    return PropertiesUtils.getBool(props, PRINT_MDLOG_PROP, false);
  }
  public static boolean doPostProcessing(Properties props) {
    return PropertiesUtils.getBool(props, POSTPROCESSING_PROP, false);
  }

  /** if true, use conll auto files, else use conll gold files */
  public static boolean useCoNLLAuto(Properties props) {
    return PropertiesUtils.getBool(props, CONLL_AUTO_PROP, true);
  }

  public static String getPathModel(Properties props, String sievename) {
    return props.getProperty(PATH_SERIALIZED_PROP) + File.separator +
        props.getProperty(PATH_MODEL_PROP.replace("SIEVENAME", sievename), "MISSING_MODEL_FOR_"+sievename);
  }
  public static boolean debug(Properties props) {

View on GitHub (pinned to 1b7edd19c4)