{"record":{"id":"aa260284868d4a94","repo":"stanfordnlp/CoreNLP","slug":"cannot-output-in-format-outputformat-from-the-i","errorCode":null,"errorMessage":"Cannot output in format ${outputFormat} from the interactive shell","messagePattern":"Cannot output in format (.+?) from the interactive shell","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLPClient.java","lineNumber":618,"sourceCode":"              new XMLOutputter().print(anno, System.out);\n              break;\n            case JSON:\n              new JSONOutputter().print(anno, System.out);\n              System.out.println();\n              break;\n            case CONLL:\n              new CoNLLOutputter().print(anno, System.out);\n              System.out.println();\n              break;\n            case TEXT:\n              new TextOutputter().print(anno, System.out);\n              break;\n            case SERIALIZED:\n              warn(\"You probably cannot read the serialized output, so printing in text instead\");\n              new TextOutputter().print(anno, System.out);\n              break;\n            default:\n              throw new IllegalArgumentException(\"Cannot output in format \" + outputFormat + \" from the interactive shell\");\n          }\n        } catch (IOException e) {\n          throw new RuntimeIOException(e);\n        }\n      }\n    });\n  }\n\n  /**\n   * The implementation of what to run on a command-line call of CoreNLPWebClient\n   *\n   * @throws IOException If any IO problem\n   */\n  public void run() throws IOException {\n    StanfordRedwoodConfiguration.minimalSetup();\n    StanfordCoreNLP.OutputFormat outputFormat = StanfordCoreNLP.OutputFormat.valueOf(properties.getProperty(\"outputFormat\", \"text\").toUpperCase(Locale.ROOT));\n\n    //","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPClient.java#L600-L636","documentation":"In StanfordCoreNLPClient's interactive shell, the chosen output format has no implemented printing path for the annotation. Only text/json/xml/html/serialized cases exist; anything else (or SERVLET-style formats) falls to default and throws IllegalArgumentException. The shell cannot honor the requested output format.","triggerScenarios":"Calling StanfordCoreNLPClient.run() with the interactive shell active while the -outputFormat property is set to a value the shell switch does not handle (e.g. 'json' omitted by build, or an arbitrary string like 'conll').","commonSituations":"Users passing server-style output formats (e.g. 'serialized', custom formats) to the client shell; typo'd outputFormat values; copy-pasting CLI options between StanfordCoreNLP and StanfordCoreNLPClient.","solutions":["Set -outputFormat to one the shell supports: text, json, xml, or html","Check the source of StanfordCoreNLPClient (shell loop) for the exact supported case labels in your version","If you need serialized output, write results programmatically via the client API instead of the interactive shell"],"exampleFix":"// before\njava -cp corenlp.jar edu.stanford.nlp.pipeline.StanfordCoreNLPClient -outputFormat conll -annotators tokenize\n// after\njava -cp corenlp.jar edu.stanford.nlp.pipeline.StanfordCoreNLPClient -outputFormat json -annotators tokenize","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"text\",\"json\",\"xml\",\"html\");\nString fmt = props.getProperty(\"outputFormat\", \"json\");\nif (!supported.contains(fmt)) throw new IllegalArgumentException(\"Shell supports only: \" + supported + \", got: \" + fmt);","typeGuard":null,"tryCatchPattern":"try {\n  client.runShell(props);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"from the interactive shell\")) {\n    props.setProperty(\"outputFormat\", \"text\");\n    client.runShell(props);\n  } else throw e;\n}","preventionTips":["Keep outputFormat within text/json/xml/html when using the interactive shell","Validate CLI flags against the client's supported set at startup"],"tags":["cli","unsupported-format","output"],"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"}