stanfordnlp/CoreNLP · error · IllegalArgumentException
Invalid ordering constraint
Error message
Invalid ordering constraint: ${ordering} What it means
When converting the sieve ordering constraints given in the OPTIMIZE_SIEVES_ORDER_PROP property into index pairs, a constraint whose BOTH sides are the wildcard '*' (ANY) is meaningless — it constrains nothing. The SieveCoreferenceSystem constructor rejects it with an IllegalArgumentException during initial order-checking of sieves.
Solutions
- Remove the fully-wildcard constraint (e.g. '*<*') from the ordering constraints property — it imposes no order
- Keep '*' on at most one side of each constraint, e.g. 'DeterministicCorefSifter<*' or '*<ExactStringMatch'
- Validate the constraint list with fromSieveOrderConstraintString logic before passing the properties to the system
- Check the ordering property value in your coref properties file for stray or duplicated wildcard entries
Example fix
// before dcoref.optimize.sievesOrder = *<*, MentionExtract<* // after dcoref.optimize.sievesOrder = *<MentionExtract, ExactStringMatch< ProperNounMatch
Defensive patterns
Strategy: validation
Validate before calling
String[] orderings = props.getProperty("dcoref.optimize.sievesOrder","").split(",");
for (String o : orderings) {
String[] sides = o.split("<");
if (sides.length == 2 && sides[0].trim().equals("*") && sides[1].trim().equals("*"))
throw new IllegalArgumentException("Useless constraint: " + o);
} Try / catch
try {
SieveCoreferenceSystem corefSystem = new SieveCoreferenceSystem(props);
} catch (IllegalArgumentException e) {
logger.warning("Bad ordering constraint, ignoring sieve-order optimization: " + e.getMessage());
props.remove("dcoref.optimize.sievesOrder");
corefSystem = new SieveCoreferenceSystem(props);
} Prevention
- Never leave '*' on both sides of a '<' constraint
- Review the full ordering property after each edit
- Document wildcard semantics for your team ('*' = any sieve, at most one per side)
When it happens
Trigger: Supplying an ordering constraint string like '*<*' in the sieve-ordering property, which fromSieveOrderConstraintString maps to Pair(-1,-1); the constructor detects p.first()<0 && p.second()<0 and throws.
Common situations: Copy-paste mistakes in coref optimization config where a wildcard was left on both sides; hand-editing constraint lists without understanding that '*' means 'any sieve'; generating constraints programmatically with an unfiltered empty/default entry.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Cannot have these two ordering constraints
- Cannot have these two ordering constraints
- Invalid metric type for
- No input file specified!
- Invalid sieve name
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/4fe42666696c1324.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java:256
if (!optimizeMetricTypeOk) {
throw new IllegalArgumentException("Invalid metric type for " +
Constants.OPTIMIZE_SIEVES_SCORE_PROP + " property: " + optimizeScoreType);
}
optimizeSubScoreType = CorefScorer.SubScoreType.valueOf(parts[1]);
if (optimizeSieves) {
String keepSieveOrder = props.getProperty(Constants.OPTIMIZE_SIEVES_KEEP_ORDER_PROP);
if (keepSieveOrder != null) {
String[] orderings = keepSieveOrder.split("\\s*,\\s*");
sievesKeepOrder = new ArrayList<>();
String firstSieveConstraint = null;
String lastSieveConstraint = null;
for (String ordering:orderings) {
// Convert ordering constraints from string
Pair<Integer,Integer> p = fromSieveOrderConstraintString(ordering, sieveClassNames);
// Do initial check of sieves order, can only have one where the first is ANY (< 0), and one where second is ANY (< 0)
if (p.first() < 0 && p.second() < 0) {
throw new IllegalArgumentException("Invalid ordering constraint: " + ordering);
} else if (p.first() < 0) {
if (lastSieveConstraint != null) {
throw new IllegalArgumentException("Cannot have these two ordering constraints: " + lastSieveConstraint + "," + ordering);
}
lastSieveConstraint = ordering;
} else if (p.second() < 0) {
if (firstSieveConstraint != null) {
throw new IllegalArgumentException("Cannot have these two ordering constraints: " + firstSieveConstraint + "," + ordering);
}
firstSieveConstraint = ordering;
}
sievesKeepOrder.add(p);
}
}
}
if(doScore){
initScorers();View on GitHub (pinned to 1b7edd19c4)