{"record":{"id":"28c92d9679495c52","repo":"stanfordnlp/CoreNLP","slug":"please-specify-stage-either-old-or-new","errorCode":null,"errorMessage":"Please specify -stage, either OLD or NEW","messagePattern":"Please specify -stage, either OLD or NEW","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/neural/ConvertModels.java","lineNumber":379,"sourceCode":"   * <code> java edu.stanford.nlp.neural.ConvertModels -stage NEW -model EMBEDDING -input /scr/nlp/data/coref/models/neural/english/english-embeddings.INT.ser.gz -output /scr/nlp/data/coref/models/neural/english/english-embeddings.e39.ser.gz</code>\n   * <br>\n   * There is another coref model which isn't used in corenlp, but it might be in the future.  To upgrade this, use <code>-model FASTCOREF</code>\n   * <br>\n   * <code> java edu.stanford.nlp.neural.ConvertModels -stage OLD -model FASTCOREF -input /scr/nlp/data/coref/models/fastneural/fast-english-model.e38.ser.gz -output /scr/nlp/data/coref/models/fastneural/fast-english-model.INT.ser.gz</code>\n   * <br>\n   * <code> java edu.stanford.nlp.neural.ConvertModels -stage NEW -model FASTCOREF -input /scr/nlp/data/coref/models/fastneural/fast-english-model.INT.ser.gz -output /scr/nlp/data/coref/models/fastneural/fast-english-model.e39.ser.gz</code>\n   * <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\");","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/neural/ConvertModels.java#L361-L397","documentation":"ConvertModels.main parses the -stage property and calls Stage.valueOf on it. A missing property (NullPointerException) or a value not matching the OLD/NEW enum (IllegalArgumentException) is rethrown as 'Please specify -stage, either OLD or NEW'.","triggerScenarios":"Running the ConvertModels main without -stage, with an empty -stage, or with a value other than OLD or NEW (case-insensitive).","commonSituations":"Command-line misconfiguration when converting legacy (OLD) models to the new (NEW) format; typos like 'new-model' or lowercase-agnostic values that still don't match.","solutions":["Add -stage OLD or -stage NEW to the command line","Check the spelling/case of the -stage value (valueOf uppercases input, so any case works if the word is right)","Run with only the supported values; inspect the Stage enum for valid names"],"exampleFix":"// before\njava edu.stanford.nlp.neural.ConvertModels -model SENTIMENT -input in.gz -output out.gz\n// after\njava edu.stanford.nlp.neural.ConvertModels -stage NEW -model SENTIMENT -input in.gz -output out.gz","handlingStrategy":"validation","validationCode":"String stage = System.getProperty(\"stage\", System.getenv(\"STAGE\"));\nif (stage == null || !(stage.equalsIgnoreCase(\"OLD\") || stage.equalsIgnoreCase(\"NEW\"))) {\n  throw new IllegalArgumentException(\"-stage must be OLD or NEW\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  ConvertModels.main(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"-stage\")) {\n    System.err.println(\"Usage: ... -stage OLD|NEW -model ... -input ... -output ...\");\n    System.exit(2);\n  }\n  throw e;\n}","preventionTips":["Always pass -stage OLD or -stage NEW explicitly in conversion scripts","Validate CLI flags in wrapper scripts before invoking the converter","Use java -X flags/aliases consistently; note the value is uppercased before valueOf"],"tags":["cli","configuration","model-conversion"],"backgroundTag":"missing-required-argument","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"}