stanfordnlp/CoreNLP · error · IllegalArgumentException

No annotator named " + name

Error message

No annotator named " + name

What it means

AnnotatorPool.get(name) looks up a pre-registered annotator factory by name; if the name was never added to the pool it throws IllegalArgumentException('No annotator named X'). It is an internal registry lookup, so the name must exactly match one registered via add().

Solutions

  1. Correct the annotator name in your 'annotators' property to a valid built-in name (tokenize,ssplit,pos,lemma,ner,parse,depparse,etc.)
  2. If it is a custom annotator, register it with AnnotatorPool.add(name, factory) before get()
  3. Check for whitespace/case errors and trailing commas in the annotators list

Example fix

// before
props.setProperty("annotators", "tokenize, ssplit,pos"); // space yields bad name lookup
// after
props.setProperty("annotators", "tokenize,ssplit,pos");
Defensive patterns

Strategy: validation

Validate before calling

String[] names = props.getProperty("annotators").split(",");
for (String n : names) {
  String t = n.trim();
  if (t.isEmpty() || !KNOWN_ANNOTATORS.contains(t)) throw new IllegalArgumentException("Unknown annotator: " + t);
}

Try / catch

try {
  Annotator a = pool.get(name);
} catch (IllegalArgumentException e) {
  // log e.getMessage(): 'No annotator named X' and list valid names
}

Prevention

When it happens

Trigger: Requesting an annotator name from the pool (via AnnotatorPool.get or StanfordCoreNLP resolving the 'annotators' property) that was never registered, e.g. a typo like 'ner ' or 'postager', or using a custom annotator without calling pool.add(name, factory).

Common situations: Typo in the 'annotators' property string; using a custom annotator name without registering it in the pool; case-sensitivity mismatch; stale code referencing an annotator removed/renamed between CoreNLP versions.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/AnnotatorPool.java:151

      }
    }
  }

  /**
   * Retrieve an Annotator from the pool. If the named Annotator has not yet
   * been requested, it will be created. Otherwise, the existing instance of
   * the Annotator will be returned.
   *
   * @param name The annotator to retrieve from the pool
   * @return The annotator
   * @throws IllegalArgumentException If the annotator cannot be created
   */
  public synchronized Annotator get(String name) {
    CachedAnnotator factory =  this.cachedAnnotators.get(name);
    if (factory != null) {
      return factory.annotator.get();
    } else {
      throw new IllegalArgumentException("No annotator named " + name);
    }
  }


  /**
   * A global singleton annotator pool, so that we can cache globally on a JVM instance.
   */
  public static final AnnotatorPool SINGLETON = new AnnotatorPool();

}

View on GitHub (pinned to 1b7edd19c4)