{"record":{"id":"0bf59692ef48d489","repo":"stanfordnlp/CoreNLP","slug":"sorry-but-options-semanticgraphmode-dependenci","errorCode":null,"errorMessage":"Sorry, but ${options.semanticGraphMode} dependencies cannot be output as part of the TextOutputter","messagePattern":"Sorry, but (.+?) dependencies cannot be output as part of the TextOutputter","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/TextOutputter.java","lineNumber":176,"sourceCode":"          break;\n        case ENHANCED:\n          graph = sentence.get(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class);\n          graphName = \"enhanced dependencies\";\n          break;\n        case ENHANCED_PLUS_PLUS:\n          graph = sentence.get(SemanticGraphCoreAnnotations.EnhancedPlusPlusDependenciesAnnotation.class);\n          graphName = \"enhanced plus plus dependencies\";\n          break;\n        case COLLAPSED:\n          graph = sentence.get(SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class);\n          graphName = \"collapsed dependencies\";\n          break;\n        case CCPROCESSED:\n          graph = sentence.get(SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation.class);\n          graphName = \"cc processed dependencies\";\n          break;\n        default:\n          throw new RuntimeException(\"Sorry, but \" + options.semanticGraphMode + \" dependencies cannot be output as part of the TextOutputter\");\n        }\n        if (graph != null) {\n          pw.println();\n          pw.println(\"Dependency Parse (\" + graphName + \"):\");\n          pw.print(graph.toList());\n        }\n\n        // display the entity mentions\n        List<CoreMap> entityMentions = sentence.get(CoreAnnotations.MentionsAnnotation.class);\n        if (entityMentions != null) {\n          pw.println();\n          pw.println(\"Extracted the following NER entity mentions:\");\n          for (CoreMap entityMention : entityMentions) {\n            String nerConfidenceEntry;\n            Map<String,Double> nerConfidences = entityMention.get(CoreAnnotations.NamedEntityTagProbsAnnotation.class);\n            String nerConfidenceKey =\n                    nerConfidences.keySet().size() > 0 ? (String) nerConfidences.keySet().toArray()[0] : \"\" ;\n            if (!nerConfidenceKey.equals(\"\") && !nerConfidenceKey.equals(\"O\"))","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/TextOutputter.java#L158-L194","documentation":"TextOutputter prints dependency graphs per sentence based on options.semanticGraphMode. The switch handles BASIC, COLLAPSED, CCPROCESSED etc.; any other SemanticGraphMode value hits the default branch and throws a RuntimeException because the requested dependency representation cannot be rendered in text output.","triggerScenarios":"Running CoreNLP with outputFormat=text while the output/dependencies option sets semanticGraphMode to an unhandled enum value (e.g. enhanced++ style modes not mapped in this outputter's switch).","commonSituations":"Setting -outputFormat text with modern dependency options (enhanced dependencies) that TextOutputter doesn't map; copying options meant for JSON output (which supports more modes) into text output.","solutions":["Use -outputFormat json or xml, which support richer dependency modes","Set the semanticGraphMode option to BASIC, COLLAPSED, or CCPROCESSED for text output","Remove the dependencies option if you only need token/sentence text output"],"exampleFix":"// before\n-outputFormat text -\"output.options\" semanticGraphMode=enhanced\n// after\n-outputFormat json -\"output.options\" semanticGraphMode=enhanced","handlingStrategy":"validation","validationCode":"if (\"text\".equals(props.getProperty(\"outputFormat\", \"text\"))) {\n  String mode = props.getProperty(\"dependencies\", props.getProperty(\"output.options\", \"\"));\n  if (mode != null && (mode.contains(\"enhanced\") || mode.contains(\"SEMANTICGRAPH\"))) {\n    props.setProperty(\"outputFormat\", \"json\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  outputText(anno, options);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"cannot be output as part of the TextOutputter\")) {\n    options.semanticGraphMode = SemanticGraphMode.COLLAPSED;\n    outputText(anno, options);\n  } else throw e;\n}","preventionTips":["For enhanced/advanced dependency output prefer JSON or XML output formats","Restrict semanticGraphMode to BASIC/COLLAPSED/CCPROCESSED with text output","Don't copy output options wholesale between different outputFormat settings"],"tags":["output","dependencies","unsupported-format"],"backgroundTag":"unsupported-enum-value","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"}