{"record":{"id":"bfa114229d47782f","repo":"stanfordnlp/CoreNLP","slug":"no-model-specified-for-parser-annotator-annotato","errorCode":null,"errorMessage":"No model specified for Parser annotator ${annotatorName}","messagePattern":"No model specified for Parser annotator (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/ParserAnnotator.java","lineNumber":121,"sourceCode":"    if (this.BUILD_GRAPHS) {\n      TreebankLanguagePack tlp = parser.getTLPParams().treebankLanguagePack();\n      this.gsf = tlp.grammaticalStructureFactory(tlp.punctuationWordRejectFilter(), parser.getTLPParams().typedDependencyHeadFinder());\n    } else {\n      this.gsf = null;\n    }\n\n    this.nThreads = 1;\n    this.saveBinaryTrees = false;\n    this.noSquash = false;\n    this.extraDependencies = GrammaticalStructure.Extras.NONE;\n    this.maxHeight = DEFAULT_MAX_HEIGHT;\n  }\n\n\n  public ParserAnnotator(String annotatorName, Properties props) {\n    String model = props.getProperty(annotatorName + \".model\", LexicalizedParser.DEFAULT_PARSER_LOC);\n    if (model == null) {\n      throw new IllegalArgumentException(\"No model specified for Parser annotator \" + annotatorName);\n    }\n    this.VERBOSE = PropertiesUtils.getBool(props, annotatorName + \".debug\", false);\n\n    String[] flags = convertFlagsToArray(props.getProperty(annotatorName + \".flags\"));\n    this.parser = loadModel(model, VERBOSE, flags);\n    this.maxSentenceLength = PropertiesUtils.getInt(props, annotatorName + \".maxlen\", -1);\n    this.maxHeight = PropertiesUtils.getInt(props, annotatorName + \".maxheight\", DEFAULT_MAX_HEIGHT);\n\n    String treeMapClass = props.getProperty(annotatorName + \".treemap\");\n    if (treeMapClass == null) {\n      this.treeMap = null;\n    } else {\n      this.treeMap = ReflectionLoading.loadByReflection(treeMapClass, props);\n    }\n\n    this.maxParseTime = PropertiesUtils.getLong(props, annotatorName + \".maxtime\", -1);\n\n    this.kBest = PropertiesUtils.getInt(props, annotatorName + \".kbest\", 1);","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/ParserAnnotator.java#L103-L139","documentation":"ParserAnnotator's constructor reads the model location from the property '<annotatorName>.model' (defaulting to LexicalizedParser.DEFAULT_PARSER_LOC) and throws IllegalArgumentException if the resolved value is null — meaning no parser model was configured.","triggerScenarios":"Constructing ParserAnnotator with Properties that set the model property to an explicit null, or a properties mechanism that resolves annotatorName+\".model\" to null (e.g. a null entry stored programmatically).","commonSituations":"Programmatic Properties objects inserting null values; custom annotator names where the model key was never set while the default constant was overridden to null; typo'd annotator name in a wrapper that reads per-name properties.","solutions":["Set the property '<annotatorName>.model' to a valid parser model path, e.g. stanfordCoreNLP.models=edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz","Inspect your Properties object for explicit null values and remove/replace them","Verify the annotator name used to construct ParserAnnotator matches the property prefix"],"exampleFix":"// before\nprops.put(\"parse.model\", null);\nParserAnnotator p = new ParserAnnotator(\"parse\", props);\n// after\nprops.setProperty(\"parse.model\", \"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz\");\nParserAnnotator p = new ParserAnnotator(\"parse\", props);","handlingStrategy":"validation","validationCode":"if (props.getProperty(annotatorName + \".model\") == null && LexicalizedParser.DEFAULT_PARSER_LOC == null) { props.setProperty(annotatorName + \".model\", \"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz\"); }","typeGuard":null,"tryCatchPattern":"try { new ParserAnnotator(\"parse\", props); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"No model specified\")) { props.setProperty(\"parse.model\", DEFAULT_MODEL); } else throw e; }","preventionTips":["Never put explicit null values into java.util.Properties","Always set <annotator>.model explicitly when constructing annotators programmatically"],"tags":["java","nlp","parser","missing-model"],"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"}