{"record":{"id":"17ee334558de4a9f","repo":"stanfordnlp/CoreNLP","slug":"please-specify-model-either-sentiment-dvparser","errorCode":null,"errorMessage":"Please specify -model, either SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF","messagePattern":"Please specify -model, either SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/neural/ConvertModels.java","lineNumber":386,"sourceCode":"   * <br>\n   *\n   * @author <a href=horatio@gmail.com>John Bauer</a>\n   */\n  public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, NoSuchMethodException {\n    Properties props = StringUtils.argsToProperties(args);\n\n    final Stage stage;\n    try {\n      stage = Stage.valueOf(props.getProperty(\"stage\").toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException | NullPointerException e) {\n      throw new IllegalArgumentException(\"Please specify -stage, either OLD or NEW\");\n    }\n\n    final Model modelType;\n    try {\n      modelType = Model.valueOf(props.getProperty(\"model\").toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException | NullPointerException e) {\n      throw new IllegalArgumentException(\"Please specify -model, either SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF\");\n    }\n\n    if (!props.containsKey(\"input\")) {\n      throw new IllegalArgumentException(\"Please specify -input\");\n    }\n\n    if (!props.containsKey(\"output\")) {\n      throw new IllegalArgumentException(\"Please specify -output\");\n    }\n\n    String inputPath = props.getProperty(\"input\");\n    String outputPath = props.getProperty(\"output\");\n\n    if (modelType == Model.SENTIMENT) {\n      if (stage == Stage.OLD) {\n        SentimentModel model = SentimentModel.loadSerialized(inputPath);\n        ObjectOutputStream out = IOUtils.writeStreamFromString(outputPath);\n        writeSentiment(model, out);","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/neural/ConvertModels.java#L368-L404","documentation":"ConvertModels.main parses the -model property into the Model enum; a missing or unrecognized value throws IllegalArgumentException('Please specify -model, either SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF').","triggerScenarios":"Running main without -model, or with a value not in {SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF}.","commonSituations":"Choosing the wrong converter invocation for the model type, typos like 'COREFMODEL', or following outdated docs that predate some enum entries.","solutions":["Add -model with one of SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF","Correct the spelling of the -model value","Check the Model enum in ConvertModels.java for the exact accepted names"],"exampleFix":"// before\n... -stage NEW -input in.gz -output out.gz\n// after\n... -stage NEW -model COREF -input in.gz -output out.gz","handlingStrategy":"validation","validationCode":"java.util.Set<String> valid = java.util.Set.of(\"SENTIMENT\",\"DVPARSER\",\"EMBEDDING\",\"COREF\",\"FASTCOREF\");\nif (model == null || !valid.contains(model.trim().toUpperCase(java.util.Locale.ROOT))) {\n  throw new IllegalArgumentException(\"-model must be one of \" + valid);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ConvertModels.main(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"-model\")) {\n    System.err.println(\"Accepted -model values: SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF\");\n    System.exit(2);\n  }\n  throw e;\n}","preventionTips":["Keep a constants list of valid -model values in conversion scripts","Echo the resolved -model value before running the converter","Update scripts when the Model enum changes"],"tags":["cli","configuration","enum","model-conversion"],"backgroundTag":"invalid-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"}