{"record":{"id":"22db5db77908eb05","repo":"stanfordnlp/CoreNLP","slug":"no-test-treebank-path-specified-22db5d","errorCode":null,"errorMessage":"No test treebank path specified...","messagePattern":"No test treebank path specified\\.\\.\\.","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/parser/lexparser/LexicalizedParser.java","lineNumber":1421,"sourceCode":"        log.info(\"Couldn't instantiate TokenizerFactory \" + tokenizerFactoryClass + \" with options \" + tokenizerOptions);\n        throw new RuntimeException(e);\n      }\n    }\n\n\n    // the following has to go after reading parser to make sure\n    // op and tlpParams are the same for train and test\n    // THIS IS BUTT UGLY BUT IT STOPS USER SPECIFIED ENCODING BEING\n    // OVERWRITTEN BY ONE SPECIFIED IN SERIALIZED PARSER\n    if (encoding != null) {\n      op.tlpParams.setInputEncoding(encoding);\n      op.tlpParams.setOutputEncoding(encoding);\n    }\n\n    if (testFilter != null || testPath != null) {\n      if (testPath == null) {\n        if (treebankPath == null) {\n          throw new RuntimeException(\"No test treebank path specified...\");\n        } else {\n          log.info(\"No test treebank path specified.  Using train path: \\\"\" + treebankPath + '\\\"');\n          testPath = treebankPath;\n        }\n      }\n      testTreebank = op.tlpParams.testMemoryTreebank();\n      testTreebank.loadPath(testPath, testFilter);\n    }\n\n    op.trainOptions.sisterSplitters = Generics.newHashSet(Arrays.asList(op.tlpParams.sisterSplitters()));\n\n    // at this point we should be sure that op.tlpParams is\n    // set appropriately (from command line, or from grammar file),\n    // and will never change again.  -- Roger\n\n    // Now what do we do with the parser we've made\n    if (saveToTextFile) {\n      // save the parser to textGrammar format","sourceCodeStart":1403,"sourceCodeEnd":1439,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/lexparser/LexicalizedParser.java#L1403-L1439","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nString[] args = {\"-testFilter\", \"regex:.*23.*\", \"-train\", \"/data/ptb/wsj/02-21\"};\n// after\nString[] args = {\"-train\", \"/data/ptb/wsj/02-21\", \"-testTreebank\", \"/data/ptb/wsj/22\"};","handlingStrategy":"validation","validationCode":"// Before invoking the constructor: verify test options carry a path\nif ((testFilter != null || testTreebankFlag) && testPath == null && treebankPath == null)\n  throw new IllegalArgumentException(\"-testTreebank (or -treebank before test options) is required\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","missing-argument","evaluation","java"],"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-15T23:17:13.987Z"}