stanfordnlp/CoreNLP · error · IllegalArgumentException
Please specify -input
Error message
Please specify -input
What it means
A required-argument check in the ConvertModels command-line tool: the -input property (path to the source model to convert) was not supplied in the properties parsed from args, so conversion cannot proceed.
Solutions
- Add -input /path/to/source/model to the command
- Fix the flag spelling so argsToProperties picks up 'input'
- Verify the property key is exactly 'input' (no leading dashes in the properties map)
Example fix
// before ... -stage NEW -model SENTIMENT -output out.gz // after ... -stage NEW -model SENTIMENT -input models/sentiment.ser.gz -output out.gz
Defensive patterns
Strategy: validation
Validate before calling
java.nio.file.Path in = java.nio.file.Path.of(inputArg);
if (inputArg == null || !java.nio.file.Files.exists(in)) {
throw new IllegalArgumentException("-input must point to an existing model file");
} Try / catch
try {
ConvertModels.main(args);
} catch (IllegalArgumentException e) {
if (e.getMessage().equals("Please specify -input")) {
System.err.println("Missing -input; usage: -input <modelPath> -output <modelPath>");
System.exit(2);
}
throw e;
} Prevention
- Always include -input in converter invocations
- Check that shell quoting doesn't drop the argument
- Validate arg presence in wrapper scripts before calling main
When it happens
Trigger: Running the converter without -input on the command line, or misspelling the flag (e.g. -in, --input) so argsToProperties never sees an 'input' key.
Common situations: Scripted conversion pipelines where the flag was dropped during refactoring, or copying an example command and omitting the path.
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 -model, either SENTIMENT, DVPARSER…
- Please specify -output
- 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/52889c90696c1eb6.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/neural/ConvertModels.java:390
public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, NoSuchMethodException {
Properties props = StringUtils.argsToProperties(args);
final Stage stage;
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);View on GitHub (pinned to 1b7edd19c4)