stanfordnlp/CoreNLP · error · IllegalArgumentException
Please specify -output
Error message
Please specify -output
What it means
IllegalArgumentException from ConvertModels.main when the -model argument is absent or not one of SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF, or when -input/-output paths are missing; these flags are mandatory for model conversion.
Solutions
- Add -output /path/to/destination/model to the command
- Fix the flag spelling so argsToProperties sees 'output'
- Quote paths containing spaces on the command line
Example fix
// before ... -stage NEW -model SENTIMENT -input models/sentiment.ser.gz // after ... -stage NEW -model SENTIMENT -input models/sentiment.ser.gz -output models/sentiment-new.ser.gz
Defensive patterns
Strategy: validation
Validate before calling
if (outputArg == null || outputArg.isBlank()) {
throw new IllegalArgumentException("-output must be a non-empty path");
} Try / catch
try {
ConvertModels.main(args);
} catch (IllegalArgumentException e) {
if (e.getMessage().equals("Please specify -output")) {
System.err.println("Missing -output; usage: -input <modelPath> -output <modelPath>");
System.exit(2);
}
throw e;
} Prevention
- Always include -output in converter invocations
- Quote paths with spaces on the command line
- Verify the output parent directory exists before conversion
When it happens
Trigger: Running the converter without -output, or misspelling the flag so the property key 'output' is missing.
Common situations: Omitting the destination when scripting batch conversions, or shell-quoting issues swallowing the argument.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Please specify -input
- Please specify -model, either SENTIMENT, DVPARSER…
- Please specify -stage, either OLD or NEW
- Conflicting properties. Multi-word rules file will be…
- Must specify a treebank to train from with -trainTreebank…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/5086b5147423ae41.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/neural/ConvertModels.java:394
try {
stage = Stage.valueOf(props.getProperty("stage").toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException | NullPointerException e) {
throw new IllegalArgumentException("Please specify -stage, either OLD or NEW");
}
final Model modelType;
try {
modelType = Model.valueOf(props.getProperty("model").toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException | NullPointerException e) {
throw new IllegalArgumentException("Please specify -model, either SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF");
}
if (!props.containsKey("input")) {
throw new IllegalArgumentException("Please specify -input");
}
if (!props.containsKey("output")) {
throw new IllegalArgumentException("Please specify -output");
}
String inputPath = props.getProperty("input");
String outputPath = props.getProperty("output");
if (modelType == Model.SENTIMENT) {
if (stage == Stage.OLD) {
SentimentModel model = SentimentModel.loadSerialized(inputPath);
ObjectOutputStream out = IOUtils.writeStreamFromString(outputPath);
writeSentiment(model, out);
out.close();
} else {
ObjectInputStream in = IOUtils.readStreamFromString(inputPath);
SentimentModel model = readSentiment(in);
in.close();
model.saveSerialized(outputPath);
}
} else if (modelType == Model.DVPARSER) {View on GitHub (pinned to 1b7edd19c4)