stanfordnlp/CoreNLP · error · IllegalArgumentException

Cannot have these two ordering constraints

Error message

Cannot have these two ordering constraints: ${firstSieveConstraint},${ordering}

What it means

Symmetric to the ANY-first case: at most one ordering constraint may have the wildcard '*' as its SECOND element ('this-before-anything'). If two such constraints are configured, the SieveCoreferenceSystem constructor throws an IllegalArgumentException naming the conflicting firstSieveConstraint and the current ordering string.

Solutions

  1. Keep at most one constraint of the form 'SieveName<*' in the ordering property
  2. Rewrite one of the conflicting constraints with explicit sieve names on both sides
  3. Use the exception message to identify which two constraints conflict and remove one
  4. Pre-validate constraints: count ANY-first (first<0) and ANY-second (second<0) entries, each must be <=1

Example fix

// before
dcoref.optimize.sievesOrder = ExactStringMatch<*, ProperNounMatch<*
// after
dcoref.optimize.sievesOrder = ExactStringMatch<*, ProperNounMatch<ExactStringMatch
Defensive patterns

Strategy: validation

Validate before calling

String[] orderings = props.getProperty("dcoref.optimize.sievesOrder","").split(",");
int anySecond = 0;
for (String o : orderings) {
  String[] sides = o.split("<");
  if (sides.length == 2 && sides[1].trim().equals("*") && ++anySecond > 1)
    throw new IllegalArgumentException("Only one 'X<*' allowed: " + o);
}

Try / catch

try {
  new SieveCoreferenceSystem(props);
} catch (IllegalArgumentException e) {
  logger.severe("Constraint conflict: " + e.getMessage());
  // remove one of the 'X<*' constraints named in the message and retry
}

Prevention

When it happens

Trigger: Configuring two constraints that both end with '*', e.g. 'A<*' and 'B<*'; detected in the constructor loop when p.second()<0 and firstSieveConstraint is already non-null.

Common situations: Hand-edited coref optimization properties accumulating multiple 'X<*' constraints; generated config from a tuning script that appends constraints without enforcing the at-most-one-ANY rule; misunderstanding wildcard semantics in sieve ordering docs.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/68090f98c034ba10. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java:264

      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();
    }

    //
    // load all dictionaries
    //
    dictionaries = new Dictionaries(props);
    semantics = (useSemantics)? new Semantics(dictionaries) : null;

View on GitHub (pinned to 1b7edd19c4)