{"record":{"id":"be7b042e6b92761f","repo":"stanfordnlp/CoreNLP","slug":"error-running","errorCode":null,"errorMessage":"Error running ","messagePattern":"Error running ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/trees/ud/UniversalDependenciesConverter.java","lineNumber":201,"sourceCode":"      log.warn(\"Error setting up \" + NER_COMBINER_NAME + \"! Not applying NER tags!\");\n    }\n  }\n\n  /** Add NER tags to a semantic graph. **/\n  private static void addNERTags(SemanticGraph sg) {\n    // set up tagger if necessary\n    if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {\n      setupNERTagger();\n    }\n    if (NER_TAGGER != null && NER_CLASSIFY_METHOD != null) {\n      // we have everything successfully setup and so can act.\n      try {\n        // classify\n        List<CoreLabel> labels =\n            sg.vertexListSorted().stream().map(IndexedWord::backingLabel).collect(Collectors.toList());\n        NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);\n      } catch (Exception ex) {\n        log.warn(\"Error running \" + NER_COMBINER_NAME + \" on SemanticGraph!  Not applying NER tags!\");\n      }\n    }\n  }\n\n  /** Add NER tags to a tree. **/\n  private static void addNERTags(Tree tree) {\n    // set up tagger if necessary\n    if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {\n      setupNERTagger();\n    }\n    if (NER_TAGGER != null && NER_CLASSIFY_METHOD != null) {\n      // we have everything successfully setup and so can act.\n      try {\n        // classify\n        List<CoreLabel> labels = tree.yield().stream().map(w -> (CoreLabel) w).collect(Collectors.toList());\n        NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);\n      } catch (Exception ex) {\n        log.warn(\"Error running \" + NER_COMBINER_NAME + \" on Tree!  Not applying NER tags!\");","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/ud/UniversalDependenciesConverter.java#L183-L219","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add stanford-corenlp-models (NER model resources) to the runtime classpath so the classifier can load its models.","Check the earlier setup warnings in the log — if setup failed, NER_TAGGER/NER_CLASSIFY_METHOD are null/invalid and every invocation will warn.","Read `ex.getCause()` of the InvocationTargetException to see the classifier's real failure (usually resource-not-found).","If NER tags are not required, disable the -ner option to avoid the per-graph warning."],"exampleFix":"// before — models missing at runtime\njava -cp stanford-corenlp.jar Main -ner\n\n// after — include the models jar\njava -cp stanford-corenlp.jar:stanford-corenlp-4.5.0-models.jar Main -ner","handlingStrategy":"try-catch","validationCode":"// Confirm NER models are resolvable before conversion\nString model = \"edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz\";\nif (UniversalDependenciesConverter.class.getClassLoader().getResource(model) == null) {\n  log.warn(\"NER models missing; -ner will be skipped\");\n}","typeGuard":"if (NER_TAGGER == null || NER_CLASSIFY_METHOD == null) {\n  return; // setup failed earlier; skip tagging\n}","tryCatchPattern":"try {\n  NER_CLASSIFY_METHOD.invoke(NER_TAGGER, labels);\n} catch (InvocationTargetException e) {\n  log.warn(\"NER classify failed: \" + e.getCause());\n} catch (Exception e) {\n  log.warn(\"NER tagging skipped: \" + e);\n}","preventionTips":["Ship the models jar with your deployment image; it is a separate, large artifact commonly forgotten.","Gate the -ner option on a successful tagger self-test at startup.","Watch logs for the 'Error setting up' warning — it predicts every subsequent 'Error running' warning.","Keep CoreNLP version and models version identical."],"tags":["reflection","ner","model-loading","nlp","invocation-failed"],"backgroundTag":"api-request-failed","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"}