stanfordnlp/CoreNLP · error · IllegalStateException
Cannot run OpenIE without a parse tree!
Error message
Cannot run OpenIE without a parse tree!
What it means
annotateSentence() requires a dependency parse: it first tries EnhancedPlusPlusDependenciesAnnotation, then BasicDependenciesAnnotation. If both are absent it cannot build the SemanticGraph needed for relation extraction, so it throws an IllegalStateException. OpenIE is a downstream annotator that depends on a parsing annotator running first.
Solutions
- Add a dependency parser to the pipeline: annotators = "tokenize,ssplit,pos,lemma,depparse,natlog,openie".
- Verify the input annotations contain EnhancedPlusPlusDependenciesAnnotation (or BasicDependenciesAnnotation) before calling annotateSentence.
- If using 'parse' instead of 'depparse', ensure the parse output is converted to dependency annotations the annotator reads.
Example fix
// before
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,openie");
// after
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,depparse,natlog,openie"); Defensive patterns
Strategy: validation
Validate before calling
if (sentence.get(SemanticGraphCoreAnnotations.EnhancedPlusPlusDependenciesAnnotation.class) == null
&& sentence.get(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class) == null) {
throw new IllegalArgumentException("Run depparse (or parse) before OpenIE");
} Try / catch
try {
openie.annotate(sentence);
} catch (IllegalStateException e) {
log.warn("Skipping sentence without dependency parse");
} Prevention
- Include depparse (and natlog) before openie in the annotator chain
- Don't feed raw pre-tokenized text straight into OpenIE
- Assert dependency annotations exist in pipeline integration tests
When it happens
Trigger: Running the openie annotator in a StanfordCoreNLP pipeline without a parser (parse or depparse), or applying OpenIE to CoreMaps/Annotations that were never parsed.
Common situations: Pipeline configured as "tokenize,ssplit,pos,lemma,openie" (missing depparse); feeding pre-tokenized annotations that skipped parsing; using a custom annotator chain that drops dependency annotations.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Cannot run Natural Logic forward entailment without…
- Unable to find words/tokens in
- unable to find sentences in
- unable to find sentences in
- Unable to find sentences in
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/45b5601c78b26480.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/naturalli/OpenIE.java:470
public void annotateSentence(CoreMap sentence, Map<CoreLabel, List<CoreLabel>> canonicalMentionMap) {
List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
if (tokens.size() < 2) {
// Short sentence. Skip annotating it.
sentence.set(NaturalLogicAnnotations.RelationTriplesAnnotation.class, Collections.emptyList());
if (!stripEntailments) {
sentence.set(NaturalLogicAnnotations.EntailedSentencesAnnotation.class, Collections.emptySet());
}
} else {
// Get the dependency tree
SemanticGraph originalParse = sentence.get(SemanticGraphCoreAnnotations.EnhancedPlusPlusDependenciesAnnotation.class);
if (originalParse == null) {
originalParse = sentence.get(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class);
}
if (originalParse == null) {
throw new IllegalStateException("Cannot run OpenIE without a parse tree!");
}
// Clean the tree
SemanticGraph parse = new SemanticGraph(originalParse);
Util.cleanTree(parse, originalParse);
// Resolve Coreference
SemanticGraph canonicalizedParse = parse;
if (resolveCoref && !canonicalMentionMap.isEmpty()) {
canonicalizedParse = canonicalizeCoref(parse, canonicalMentionMap);
}
// Run OpenIE
// (clauses)
List<SentenceFragment> clauses = clausesInSentence(canonicalizedParse, true); // note: uses coref-canonicalized parse
// (entailment)
Set<SentenceFragment> fragments = entailmentsFromClauses(clauses);
// (segment)
List<RelationTriple> extractions = segmenter.extract(parse, tokens); // note: uses non-coref-canonicalized parse!View on GitHub (pinned to 1b7edd19c4)