{"record":{"id":"c04f99a81b25f455","repo":"stanfordnlp/CoreNLP","slug":"annotator-s-requires-annotation-s-the-usual","errorCode":null,"errorMessage":"annotator \"%s\" requires annotation \"%s\". The usual requirements for this annotator are: %s","messagePattern":"annotator \"(.+?)\" requires annotation \"(.+?)\"\\. The usual requirements for this annotator are: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java","lineNumber":292,"sourceCode":"    Set<Class<? extends CoreAnnotation>> requirementsSatisfied = Generics.newHashSet();\n    for (String name : annoNames) {\n      name = name.trim();\n      if (name.isEmpty()) { continue; }\n      logger.info(\"Adding annotator \" + name);\n\n      Annotator an = pool.get(name);\n      this.addAnnotator(an);\n\n      if (enforceRequirements) {\n        Set<Class<? extends CoreAnnotation>> allRequirements = an.requires();\n        for (Class<? extends CoreAnnotation> requirement : allRequirements) {\n          if (!requirementsSatisfied.contains(requirement)) {\n            String fmt = \"annotator \\\"%s\\\" requires annotation \\\"%s\\\". The usual requirements for this annotator are: %s\";\n            Collection<String> defaultRequirements = an.exactRequirements();\n            if (defaultRequirements == null) {\n              defaultRequirements = Annotator.DEFAULT_REQUIREMENTS.getOrDefault(name, Collections.singleton(\"unknown\"));\n            }\n            throw new IllegalArgumentException(String.format(fmt, name, requirement.getSimpleName(), StringUtils.join(defaultRequirements, \",\")));\n          }\n        }\n        requirementsSatisfied.addAll(an.requirementsSatisfied());\n      }\n\n      alreadyAddedAnnoNames.add(name);\n    }\n\n    // Sanity check\n    if (! alreadyAddedAnnoNames.contains(STANFORD_SSPLIT)) {\n      System.setProperty(NEWLINE_SPLITTER_PROPERTY, \"false\");\n    }\n    this.pipelineSetupTime = tim.report();\n  }\n\n  /**\n   * update the annotators, hopefully in a backwards compatible manner\n   */","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java#L274-L310","documentation":"StanfordCoreNLP's requirements-checking logic verifies, after adding each annotator, that every annotation class it requires (an.requirementCheck / unmet requirement) was satisfied by earlier annotators. If a requirement is missing it throws IllegalArgumentException naming the annotator, the missing annotation class, and the default requirements list.","triggerScenarios":"Declaring annotators in an order that leaves prerequisites unsatisfied (e.g. parse without tokenize/ssplit, ner without tokenize) so an earlier annotator never produced the required CoreAnnotations class.","commonSituations":"Hand-edited pipeline strings like annotators=parse or annotators=dcoref,semgraph; custom Annotator implementations whose REQUIREMENTS don't match what preceding annotators satisfy; dropping 'tokenize' to skip tokenization.","solutions":["Reorder/extend the annotators property so prerequisites run first, e.g. tokenize,ssplit,pos,lemma,ner,parse.","Read the message's 'usual requirements' list and add annotators that satisfy the named missing annotation.","For custom annotators, correctly declare requirementsSatisfied()/requirements() so the checker sees the produced annotations."],"exampleFix":"// before\nprops.setProperty(\"annotators\", \"parse\");\n// after\nprops.setProperty(\"annotators\", \"tokenize,ssplit,pos,parse\");","handlingStrategy":"validation","validationCode":"// Use CoreNLP's own check before building:\nProperties props = new Properties();\nprops.setProperty(\"annotators\", \"tokenize,ssplit,pos,lemma,ner,parse\");\nStanfordCoreNLP pipeline = new StanfordCoreNLP(props); // throws with the same message if requirements unmet — construct early\npipeline.annotate(annotation);","typeGuard":null,"tryCatchPattern":"try {\n  new StanfordCoreNLP(props).annotate(ann);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"requires annotation\")) {\n    log.error(\"Pipeline misconfigured, fix annotator order: \" + e.getMessage());\n    throw new IllegalStateException(\"Invalid annotators property\", e);\n  }\n  throw e;\n}","preventionTips":["Run the canonical chain: tokenize,ssplit,pos,lemma,ner,parse as needed, never a subset that skips prerequisites.","Read the 'usual requirements' in the error message and add the listed annotators.","Declare accurate requirementsSatisfied()/requirements() in custom Annotators.","Construct StanfordCoreNLP at startup so requirement errors surface before serving traffic."],"tags":["corenlp","pipeline","requirements","configuration"],"backgroundTag":"missing-required-argument","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"}