{"record":{"id":"35782f142534a6b4","repo":"stanfordnlp/CoreNLP","slug":"unknown-annotator-annotator","errorCode":null,"errorMessage":"Unknown annotator: ${annotator}","messagePattern":"Unknown annotator: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java","lineNumber":492,"sourceCode":"   * pos. As a side effect, this function orders the annotators in the proper order.\n   * Note that this is not guaranteed to return a valid set of annotators,\n   * as properties passed to the annotators can change their requirements.\n   *\n   * @param annotators The annotators the user has requested.\n   * @return A sanitized annotators string with all prerequisites met.\n   */\n  public static String ensurePrerequisiteAnnotators(String[] annotators, Properties props) {\n    int posIndex = ArrayUtils.indexOf(annotators, Annotator.STANFORD_POS);\n    int parseIndex = ArrayUtils.indexOf(annotators, Annotator.STANFORD_PARSE);\n    boolean useParseForPos = ((parseIndex >= 0) && (posIndex < 0)); // Already doing the parsing, use the parsing for the pos tag\n\n    // Get an unordered set of annotators\n    Set<String> unorderedAnnotators = new LinkedHashSet<>();  // linked to preserve order\n    Collections.addAll(unorderedAnnotators, annotators);\n    for (String annotator : annotators) {\n      // Add the annotator\n      if (!getNamedAnnotators().containsKey(annotator.toLowerCase())) {\n        throw new IllegalArgumentException(\"Unknown annotator: \" + annotator);\n      }\n\n      // Add its transitive dependencies\n      unorderedAnnotators.add(annotator.toLowerCase());\n      if (!Annotator.DEFAULT_REQUIREMENTS.containsKey(annotator.toLowerCase())) {\n        throw new IllegalArgumentException(\"Cannot infer requirements for annotator: \" + annotator);\n      }\n      Queue<String> fringe = new LinkedList<>(Annotator.DEFAULT_REQUIREMENTS.get(annotator.toLowerCase()));\n      int ticks = 0;\n      while (!fringe.isEmpty()) {\n        ticks += 1;\n        if (ticks == 1000000) {\n          throw new IllegalStateException(\"[INTERNAL ERROR] Annotators have a circular dependency.\");\n        }\n        String prereq = fringe.poll();\n        unorderedAnnotators.add(prereq);\n        fringe.addAll(Annotator.DEFAULT_REQUIREMENTS.get(prereq.toLowerCase()));\n      }","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java#L474-L510","documentation":"ensurePrerequisiteAnnotators validates every annotator name in the requested list against the registry of named annotators (getNamedAnnotators()). If a name is not registered (case-insensitively), it throws IllegalArgumentException 'Unknown annotator'.","triggerScenarios":"Setting props 'annotators' to a name not in the registry, e.g. misspellings ('tokenizer', 'sentencesplit'), custom annotators not registered via AnnotationsPipeline/customAnnotatorClass, or names removed in newer CoreNLP versions.","commonSituations":"Typo in StanfordCoreNLP.properties annotators line; copying config from a tutorial using an old annotator name; expecting a model-specific annotator without loading the right models jar.","solutions":["Fix the annotator name to a valid one (tokenize, ssplit, pos, lemma, ner, parse, depparse, coref, dcoref, natlog, sentiment, etc.).","Register a custom annotator via props 'customAnnotatorClass.<name> = fqcn' so the name resolves.","Call StanfordCoreNLP.getNamedAnnotators() (or print AvailableEditors/defaults) to list valid names for your version.","Remove annotators made unavailable by a version upgrade and add their modern replacements."],"exampleFix":"// before\nprops.setProperty(\"annotators\", \"tokenize, ssplit, tokenize\");\n// after\nprops.setProperty(\"annotators\", \"tokenize,ssplit,pos,lemma\");","handlingStrategy":"validation","validationCode":"Set<String> known = StanfordCoreNLP.getNamedAnnotators().keySet();\nfor (String a : props.getProperty(\"annotators\").split(\",\\\\s*\")) {\n  if (!known.contains(a.trim().toLowerCase())) {\n    throw new IllegalArgumentException(\"Invalid annotator: \" + a);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { pipeline = new StanfordCoreNLP(props); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unknown annotator\")) { log.error(\"Check annotators property: {}\", e.getMessage()); } throw e; }","preventionTips":["Keep a whitelist of valid annotator names for your CoreNLP version and validate config at startup.","Register custom annotators with customAnnotatorClass.<name> before referencing them.","Re-validate annotator names after any CoreNLP version upgrade."],"tags":["java","configuration","invalid-value","annotators"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}