{"record":{"id":"f435ed639d5d26c0","repo":"stanfordnlp/CoreNLP","slug":"unable-to-find-sentences-in-annotation-f435ed","errorCode":null,"errorMessage":"unable to find sentences in: \" + annotation","messagePattern":"unable to find sentences in: \" \\+ annotation","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/CharniakParserAnnotator.java","lineNumber":79,"sourceCode":"        if (VERBOSE) {\n          log.info(\"Parsing: \" + words);\n        }\n        int maxSentenceLength = parser.getMaxSentenceLength();\n        // generate the constituent tree\n        Tree tree; // initialized below\n        if (maxSentenceLength <= 0 || words.size() < maxSentenceLength) {\n          tree = parser.getBestParse(words);\n        }\n        else {\n          tree = ParserUtils.xTree(words);\n        }\n\n        List<Tree> trees = Generics.newArrayList(1);\n        trees.add(tree);\n        ParserAnnotatorUtils.fillInParseAnnotations(VERBOSE, BUILD_GRAPHS, gsf, sentence, trees, GrammaticalStructure.Extras.NONE);\n      }\n    } else {\n      throw new RuntimeException(\"unable to find sentences in: \" + annotation);\n    }\n  }\n\n  @Override\n  public Set<Class<? extends CoreAnnotation>> requires() {\n    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(\n        CoreAnnotations.TextAnnotation.class,\n        CoreAnnotations.TokensAnnotation.class,\n        CoreAnnotations.CharacterOffsetBeginAnnotation.class,\n        CoreAnnotations.CharacterOffsetEndAnnotation.class,\n        CoreAnnotations.SentencesAnnotation.class\n    )));\n  }\n\n  @Override\n  public Set<Class<? extends CoreAnnotation>> requirementsSatisfied() {\n    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(\n        CoreAnnotations.PartOfSpeechAnnotation.class,","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/CharniakParserAnnotator.java#L61-L97","documentation":"CharniakParserAnnotator.annotate() parses each sentence found in the Annotation; if SentencesAnnotation is absent there is nothing to parse and it throws this RuntimeException. Like other parsers it requires tokenization and sentence splitting as prerequisites.","triggerScenarios":"Running the Charniak parser annotator on an Annotation with no CoreAnnotations.SentencesAnnotation, typically because tokenize/ssplit did not run first.","commonSituations":"Building a pipeline with only the parser annotator; incorrect annotator ordering; a previous annotator silently failing to add sentences.","solutions":["Include 'tokenize,ssplit' before the parser in the annotators list","Check pipeline ordering when composing annotators manually","Ensure earlier annotators ran without exceptions that left the annotation empty"],"exampleFix":"// before\nprops.setProperty(\"annotators\", \"charniak\");\n// after\nprops.setProperty(\"annotators\", \"tokenize,ssplit,charniak\");","handlingStrategy":"validation","validationCode":"if (annotation.get(CoreAnnotations.SentencesAnnotation.class) == null) {\n  throw new IllegalStateException(\"Run tokenize+ssplit before CharniakParserAnnotator\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  parser.annotate(annotation);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"unable to find sentences\")) {\n    // rerun pipeline with tokenize,ssplit first\n  } else throw e;\n}","preventionTips":["Include tokenize,ssplit before the parser in the annotators list","Prefer StanfordCoreNLP pipeline declaration so prerequisites are enforced"],"tags":["stanford-corenlp","missing-prerequisite","pipeline-order","parser"],"backgroundTag":"missing-required-config-field","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}