stanfordnlp/CoreNLP · error · RuntimeException
No test treebank path specified...
Error message
No test treebank path specified...
What it means
Same pattern as the tune path check: a test filter or test path was requested in the order-dependent LexicalizedParser constructor, but testPath was null and no treebankPath (train path) was available to fall back to. The constructor throws "No test treebank path specified..." because evaluation cannot proceed without a test treebank location.
Solutions
- Add a -testTreebank <path> argument to your command
- Or place -treebank <trainPath> before the test options so testPath defaults to the train path
- Remove -testFilter/test flags if no held-out evaluation is needed
Example fix
// before
String[] args = {"-testFilter", "regex:.*23.*", "-train", "/data/ptb/wsj/02-21"};
// after
String[] args = {"-train", "/data/ptb/wsj/02-21", "-testTreebank", "/data/ptb/wsj/22"}; Defensive patterns
Strategy: validation
Validate before calling
// Before invoking the constructor: verify test options carry a path
if ((testFilter != null || testTreebankFlag) && testPath == null && treebankPath == null)
throw new IllegalArgumentException("-testTreebank (or -treebank before test options) is required"); Prevention
- Always pass -testTreebank for evaluation runs
- Place -treebank/-train before test options in argument lists
- Keep eval scripts self-contained with explicit train and test paths
When it happens
Trigger: Passing -testFilter or a test-treebank flag to the training/evaluation constructor without -testTreebank, and with treebankPath still null at that point in argument processing.
Common situations: Setting up an eval script and including -testFilter but omitting -testTreebank; reordering arguments so -treebank comes after the test options; copying training flags into an eval script incompletely.
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
- Must specify input with -input
- Must specify output with -output
- -o argument (output path for built tagger) is required
- Must supply either a base parser model with -parser or a…
- Need to either train a new model, run the gradient check or…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/22db5db77908eb05.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/lexparser/LexicalizedParser.java:1421
log.info("Couldn't instantiate TokenizerFactory " + tokenizerFactoryClass + " with options " + tokenizerOptions);
throw new RuntimeException(e);
}
}
// the following has to go after reading parser to make sure
// op and tlpParams are the same for train and test
// THIS IS BUTT UGLY BUT IT STOPS USER SPECIFIED ENCODING BEING
// OVERWRITTEN BY ONE SPECIFIED IN SERIALIZED PARSER
if (encoding != null) {
op.tlpParams.setInputEncoding(encoding);
op.tlpParams.setOutputEncoding(encoding);
}
if (testFilter != null || testPath != null) {
if (testPath == null) {
if (treebankPath == null) {
throw new RuntimeException("No test treebank path specified...");
} else {
log.info("No test treebank path specified. Using train path: \"" + treebankPath + '\"');
testPath = treebankPath;
}
}
testTreebank = op.tlpParams.testMemoryTreebank();
testTreebank.loadPath(testPath, testFilter);
}
op.trainOptions.sisterSplitters = Generics.newHashSet(Arrays.asList(op.tlpParams.sisterSplitters()));
// at this point we should be sure that op.tlpParams is
// set appropriately (from command line, or from grammar file),
// and will never change again. -- Roger
// Now what do we do with the parser we've made
if (saveToTextFile) {
// save the parser to textGrammar formatView on GitHub (pinned to 1b7edd19c4)