stanfordnlp/CoreNLP · error · IllegalArgumentException

Cannot have these two ordering constraints

Error message

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

What it means

Among the sieve ordering constraints, at most one may have the wildcard '*' as its FIRST element (an 'anything-before-this' constraint). If a second such constraint appears, the constructor throws an IllegalArgumentException naming the two conflicting constraints, because no total sieve order can be checked/optimized against two simultaneous ANY-first constraints.

Solutions

  1. Keep only one constraint of the form '*<SieveName' in the ordering property
  2. Delete or rewrite the second ANY-first constraint to name an explicit sieve on the left
  3. Check the lastSieveConstraint conflict message in the exception — it tells you exactly which two constraints collide
  4. Validate the full constraint list (one ANY-first, one ANY-second max) before running the system

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 anyFirst = 0;
for (String o : orderings) {
  String[] sides = o.split("<");
  if (sides.length == 2 && sides[0].trim().equals("*") && ++anyFirst > 1)
    throw new IllegalArgumentException("Only one '*<X' allowed: " + o);
}

Try / catch

try {
  new SieveCoreferenceSystem(props);
} catch (IllegalArgumentException e) {
  logger.severe("Constraint conflict: " + e.getMessage());
  // parse message, drop the duplicated ANY-first constraint, retry
}

Prevention

When it happens

Trigger: Configuring the sieve-ordering property with two constraints that both start with '*', e.g. '*<A' followed by '*<B'; detected when the loop encounters p.first()<0 while lastSieveConstraint is already set.

Common situations: Accumulating leftover wildcard constraints in a coref tuning properties file after edits; misunderstanding that only one '*<' constraint is allowed; automated constraint generation that doesn't dedupe ANY-first entries.

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/d5c6ab10782ca754. Report an issue: GitHub.

Appendix: source

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

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