stanfordnlp/CoreNLP · error · RuntimeException
Expected a property " + name + ".model
Error message
Expected a property " + name + ".model
What it means
ArabicSegmenterAnnotator requires a segmentation model file. After scanning the properties for '<name>.model' (e.g. arabic.model), if no model path was found it throws this RuntimeException before loadModel().
Solutions
- Set the model property, e.g. props.setProperty("arabicsegmenter.model", "data/arabic-segmenter-atbtrain.ser.gz")
- Ensure the model file exists and is a valid serialized segmenter model
- Confirm the property prefix matches the name the annotator was created with
Example fix
// before
props.setProperty("annotators", "arabicsegmenter");
// after
props.setProperty("annotators", "arabicsegmenter");
props.setProperty("arabicsegmenter.model", "edu/stanford/nlp/models/arabic/segmentation/arabic-segmenter-atbtrain.ser.gz"); Defensive patterns
Strategy: validation
Validate before calling
if (props.getProperty("arabicsegmenter.model") == null && props.getProperty("model") == null) {
throw new IllegalArgumentException("arabicsegmenter requires a model property");
} Try / catch
try {
new ArabicSegmenterAnnotator(name, props);
} catch (RuntimeException e) {
if (e.getMessage().contains("Expected a property")) {
// set the .model property and retry
} else throw e;
} Prevention
- Include the stanford-arabic models jar or provide your own model path
- Verify model file existence before pipeline creation
- Keep property prefixes consistent with the annotator name
When it happens
Trigger: Adding the 'arabicsegmenter' annotator to a pipeline without setting the '<prefix>.model' property, or setting a misspelled key the property scan doesn't recognize.
Common situations: Forgetting to download the Arabic segmentation model; using the wrong properties prefix; model property set under a name that doesn't match the annotator's configured name.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Expected a property " + name + ".model
- Must load a classifier when creating a column data…
- No annotator named " + name
- Invalid annotation to tag pattern: " + annoPatternString
- Tokenization model was not specified in
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/55dae625aa92a355.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/ArabicSegmenterAnnotator.java:76
public ArabicSegmenterAnnotator(String name, Properties props) {
String model = null;
// Keep only the properties that apply to this annotator
Properties modelProps = new Properties();
String desiredKey = name + '.';
for (String key : props.stringPropertyNames()) {
if (key.startsWith(desiredKey)) {
// skip past name and the subsequent "."
String modelKey = key.substring(desiredKey.length());
if (modelKey.equals("model")) {
model = props.getProperty(key);
} else {
modelProps.setProperty(modelKey, props.getProperty(key));
}
}
}
this.VERBOSE = PropertiesUtils.getBool(props, name + ".verbose", false);
if (model == null) {
throw new RuntimeException("Expected a property " + name + ".model");
}
loadModel(model, modelProps);
// TODO: unify with ChineseSegmenterAnnotator somehow?
// The issue here is the Chinese segmenter returns text chunks and
// the Arabic segmenter has a method which returns CoreLabels, so
// the project of unifying the two into one ur-SegmenterAnnotator
// is larger than simply ripping some code into a superclass and
// calling it a day
// If newlines are treated as sentence split, we need to retain them in tokenization for ssplit to make use of them
tokenizeNewline = (!props.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, "never").equals("never"))
|| Boolean.valueOf(props.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false"));
// record whether or not sentence splitting on two newlines ; if so, need to remove single newlines
sentenceSplitOnTwoNewlines =
props.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, "never").equals("two");
}View on GitHub (pinned to 1b7edd19c4)