{"record":{"id":"025f7d3da1d72fbb","repo":"stanfordnlp/CoreNLP","slug":"expected-a-property-name-model-025f7d","errorCode":null,"errorMessage":"Expected a property \" + name + \".model","messagePattern":"Expected a property \" \\+ name \\+ \"\\.model","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/ChineseSegmenterAnnotator.java","lineNumber":93,"sourceCode":"    String model = null;\n    // Keep only the properties that apply to this annotator\n    Properties modelProps = new Properties();\n    String desiredKey = name + '.';\n    for (String key : props.stringPropertyNames()) {\n      if (key.startsWith(desiredKey)) {\n        // skip past name and the subsequent \".\"\n        String modelKey = key.substring(desiredKey.length());\n        if (modelKey.equals(\"model\")) {\n          model = props.getProperty(key);\n        } else {\n          modelProps.setProperty(modelKey, props.getProperty(key));\n        }\n      }\n    }\n    this.VERBOSE = PropertiesUtils.getBool(props, name + \".verbose\", false);\n    this.normalizeSpace = PropertiesUtils.getBool(props, name + \".normalizeSpace\", false);\n    if (model == null) {\n      throw new RuntimeException(\"Expected a property \" + name + \".model\");\n    }\n    // don't write very much, because the CRFClassifier already reports loading\n    if (VERBOSE) {\n      log.info(\"Loading Segmentation Model ... \");\n    }\n    try {\n      segmenter = CRFClassifier.getClassifier(model, modelProps);\n    } catch (RuntimeException e) {\n      throw e;\n    } catch (Exception e) {\n      throw new RuntimeException(e);\n    }\n\n    // If newlines are treated as sentence split, we need to retain them in tokenization for ssplit to make use of them\n    tokenizeNewline = (!props.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, \"never\").equals(\"never\"))\n            || Boolean.valueOf(props.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, \"false\"));\n\n    // record whether or not sentence splitting on two newlines ; if so, need to remove single newlines","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/ChineseSegmenterAnnotator.java#L75-L111","documentation":"ChineseSegmenterAnnotator requires a CRF segmentation model. After collecting properties, if no model path was specified via '<name>.model' it throws this RuntimeException instead of loading a null model.","triggerScenarios":"Creating a ChineseSegmenterAnnotator (or using 'chinesesegmenter' in a pipeline) without setting e.g. 'chinesesegmenter.model', or setting the key under a prefix that doesn't match the annotator name.","commonSituations":"Missing the stanford-chinese-corenlp models jar; typo in the model property; switching to a custom annotator name without renaming the model property.","solutions":["Set the model property: props.setProperty(\"chinesesegmenter.model\", \"edu/stanford/nlp/models/segmenter/chinese/ctb.gz\")","Add the stanford-chinese-corenlp models jar to the classpath so the default model resolves","Verify the property prefix matches the annotator name used in the pipeline"],"exampleFix":"// before\nprops.setProperty(\"annotators\", \"segment\");\n// after\nprops.setProperty(\"annotators\", \"segment\");\nprops.setProperty(\"segment.model\", \"edu/stanford/nlp/models/segmenter/chinese/ctb.gz\");","handlingStrategy":"validation","validationCode":"if (props.getProperty(name + \".model\") == null) {\n  throw new IllegalArgumentException(name + \" requires a .model property\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  new ChineseSegmenterAnnotator(name, props);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"Expected a property\")) {\n    // set segment.model and retry\n  } else throw e;\n}","preventionTips":["Add the stanford-chinese-corenlp models jar to the classpath","Verify the model resource exists before pipeline creation","Match the property prefix to the annotator name"],"tags":["stanford-corenlp","missing-model","configuration","chinese-segmenter"],"backgroundTag":"missing-required-config-field","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"}