stanfordnlp/CoreNLP · error · IllegalArgumentException

entitySubclassify: unknown style:

Error message

entitySubclassify: unknown style: 

What it means

IOBUtils.entitySubclassify rewrites IOB-style entity tags into one of several supported styles (io, io2, iob1, iob2, iobes, bieo, bilou). Any other style string hits the switch default and throws IllegalArgumentException('entitySubclassify: unknown style: ' + style).

Solutions

  1. Use one of the supported lowercase styles: io, io2, iob1, iob2, iobes, bieo, bilou.
  2. Normalize the incoming style string with toLowerCase() before passing it in.
  3. Remove or fix the config/property supplying the invalid style value.

Example fix

// before
entitySubclassify(tokens, "BILOU", ...);
// after
entitySubclassify(tokens, "bilou", ...);
Defensive patterns

Strategy: validation

Validate before calling

static final Set<String> STYLES = Set.of("io","io2","iob1","iob2","iobes","bieo","bilou");
if (!STYLES.contains(style.toLowerCase())) throw new IllegalArgumentException("bad entitySubclassify style: " + style);

Prevention

When it happens

Trigger: Calling entitySubclassify(tokens, style, ...) with a style string not in {io, io2, iob1, iob2, iobes, bieo, bilou} — e.g. "BILOU" (case-sensitive switch) or "iobes+", at IOBUtils.java:92.

Common situations: Passing a dataset config value like "BILOU" or "conll" as the sub-classification style; typos; env/config where the style string comes from user-supplied properties.

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/d246e3226649253d. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/sequences/IOBUtils.java:92

        break;
      case "ioe2":
        how = 3;
        break;
      case "io":
        how = 4;
        break;
      case "sbieo":
      case "iobes":
        how = 5;
        break;
      case "noprefix":
        how = 6;
        break;
      case "bilou":
        how = 7;
        break;
      default:
        throw new IllegalArgumentException("entitySubclassify: unknown style: " + style);
    }
    List<TOK> paddedTokens = new PaddedList<>(tokens, (TOK) new CoreLabel());
    int size = paddedTokens.size();
    String[] newAnswers = new String[size];
    for (int i = 0; i < size; i++) {
      TOK c = paddedTokens.get(i);
      TOK p = paddedTokens.get(i - 1);
      TOK n = paddedTokens.get(i + 1);
      String cAns = c.get(key);
      String pAns = p.get(key);
      if (pAns == null) {
        pAns = backgroundLabel;
      }
      String nAns = n.get(key);
      if (nAns == null) {
        nAns = backgroundLabel;
      }
      String base;

View on GitHub (pinned to 1b7edd19c4)