stanfordnlp/CoreNLP · warning

Error running

Error message

Error running 

What it means

addNERTags(SemanticGraph) invokes the reflectively obtained NER classify method on the sorted vertex labels of the graph. Any exception during invocation (InvocationTargetException from the classifier, e.g. missing NER model files, or IllegalStateException because setup failed) is caught and logged as 'Error running NERClassifierCombiner on SemanticGraph! Not applying NER tags!'. Conversion still succeeds, just without NER annotation.

Solutions

  1. Add stanford-corenlp-models (NER model resources) to the runtime classpath so the classifier can load its models.
  2. Check the earlier setup warnings in the log — if setup failed, NER_TAGGER/NER_CLASSIFY_METHOD are null/invalid and every invocation will warn.
  3. Read `ex.getCause()` of the InvocationTargetException to see the classifier's real failure (usually resource-not-found).
  4. If NER tags are not required, disable the -ner option to avoid the per-graph warning.

Example fix

// before — models missing at runtime
java -cp stanford-corenlp.jar Main -ner

// after — include the models jar
java -cp stanford-corenlp.jar:stanford-corenlp-4.5.0-models.jar Main -ner
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm NER models are resolvable before conversion
String model = "edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz";
if (UniversalDependenciesConverter.class.getClassLoader().getResource(model) == null) {
  log.warn("NER models missing; -ner will be skipped");
}

Type guard

if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {
  return; // setup failed earlier; skip tagging
}

Try / catch

try {
  NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);
} catch (InvocationTargetException e) {
  log.warn("NER classify failed: " + e.getCause());
} catch (Exception e) {
  log.warn("NER tagging skipped: " + e);
}

Prevention

When it happens

Trigger: Calling convertTreeToBasic or main with NER enabled on a SemanticGraph when the classifier was never initialized (earlier setup failure) — NER_CLASSIFY_METHOD.invoke on null, or the classifier throws while labeling because model files (english.all.3class.distsim etc.) are missing from the classpath.

Common situations: Models jar not on the runtime classpath even though code jars are; running in a container or serverless image that omitted the large models artifact; classify failing on unusual label types; earlier 'Error setting up' warning being ignored.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/trees/ud/UniversalDependenciesConverter.java:201

      log.warn("Error setting up " + NER_COMBINER_NAME + "! Not applying NER tags!");
    }
  }

  /** Add NER tags to a semantic graph. **/
  private static void addNERTags(SemanticGraph sg) {
    // set up tagger if necessary
    if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {
      setupNERTagger();
    }
    if (NER_TAGGER != null && NER_CLASSIFY_METHOD != null) {
      // we have everything successfully setup and so can act.
      try {
        // classify
        List<CoreLabel> labels =
            sg.vertexListSorted().stream().map(IndexedWord::backingLabel).collect(Collectors.toList());
        NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);
      } catch (Exception ex) {
        log.warn("Error running " + NER_COMBINER_NAME + " on SemanticGraph!  Not applying NER tags!");
      }
    }
  }

  /** Add NER tags to a tree. **/
  private static void addNERTags(Tree tree) {
    // set up tagger if necessary
    if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {
      setupNERTagger();
    }
    if (NER_TAGGER != null && NER_CLASSIFY_METHOD != null) {
      // we have everything successfully setup and so can act.
      try {
        // classify
        List<CoreLabel> labels = tree.yield().stream().map(w -> (CoreLabel) w).collect(Collectors.toList());
        NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);
      } catch (Exception ex) {
        log.warn("Error running " + NER_COMBINER_NAME + " on Tree!  Not applying NER tags!");

View on GitHub (pinned to 1b7edd19c4)