stanfordnlp/CoreNLP · error
Error: No training file provided in properties or via…
Error message
Error: No training file provided in properties or via command line --trainFile
What it means
BuildMultiWordRules.main is a CLI tool that infers multi-word tokenization rules from a training file. Before doing any work it checks the 'trainFile' property parsed from the command line; if absent it logs this error and returns without throwing. It exists because the tool cannot run without training data.
Solutions
- Pass the training file explicitly: -trainFile path/to/train.conllu.
- Check argument spelling matches exactly 'trainFile'.
- Run without args or consult the class source to confirm required flags.
- If using a properties file, ensure it contains a trainFile key reachable by StringUtils.argsToProperties.
Example fix
// before java -cp ... edu.stanford.nlp.process.stattok.BuildMultiWordRules data/train.conllu // after java -cp ... edu.stanford.nlp.process.stattok.BuildMultiWordRules -trainFile data/train.conllu -multiWordRulesFile rules.txt
Defensive patterns
Strategy: validation
Validate before calling
Properties p = StringUtils.argsToProperties(args);
if (p.getProperty("trainFile") == null) {
throw new IllegalArgumentException("Usage: BuildMultiWordRules -trainFile <train.conllu> -multiWordRulesFile <out>");
} Prevention
- Wrap tool invocations in shell scripts that assert required flags.
- Always pass files with explicit -flag value syntax, never positionally.
- Add -help-style dry runs in CI to validate command templates.
When it happens
Trigger: Running `java edu.stanford.nlp.process.stattok.BuildMultiWordRules` without a -trainFile <path> argument (or properties entry), so properties.getProperty("trainFile") is null.
Common situations: Forgetting the argument name dash convention; passing the training file positionally instead of via -trainFile; misspelling the property (e.g. --trainingFile); reusing a script written for StatTokSentTrainer with different flags.
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
- Error: No dest file provided in properties or via command…
- Error: No training file provided in properties or via…
- Error: -train option must have treebankPath as first…
- -labels is required
- Must specify input with -input
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/a4f175b483838df7.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/process/stattok/BuildMultiWordRules.java:26
import java.util.Map;
import java.util.Properties;
import edu.stanford.nlp.util.StringUtils;
import edu.stanford.nlp.util.logging.Redwood;
public class BuildMultiWordRules {
private static final Redwood.RedwoodChannels logger = Redwood.channels(StatTokSentTrainer.class);
// disallow making this class
private BuildMultiWordRules() {}
public static void main(String[] args) throws IOException {
Properties properties = StringUtils.argsToProperties(args);
String trainFile = properties.getProperty("trainFile", null);
String multiWordRulesFile = properties.getProperty("multiWordRulesFile", null);
if (trainFile == null){
logger.err("Error: No training file provided in properties or via command line --trainFile");
return;
}
if (multiWordRulesFile == null){
logger.err("Error: No dest file provided in properties or via command line --multiWordRulesFile");
return;
}
Map<String, String[]> rules = StatTokSentTrainer.inferMultiWordRules(trainFile);
StatTokSentTrainer.writeMultiWordRules(multiWordRulesFile, rules);
}
}View on GitHub (pinned to 1b7edd19c4)