stanfordnlp/CoreNLP · error · IllegalArgumentException

Invalid sieve ordering constraint

Error message

Invalid sieve ordering constraint: ${s}

What it means

fromSieveOrderConstraintString parses each ordering constraint by splitting on '<' and requires exactly two parts. If the constraint string does not contain exactly one '<' separator (parts.length != 2), it throws an IllegalArgumentException 'Invalid sieve ordering constraint: <s>'.

Solutions

  1. Ensure every constraint has the form 'SieveA<SieveB' with exactly one '<'
  2. Check that constraint entries are comma-separated and none accidentally contains extra '<' characters
  3. Trim whitespace/newlines from the property value; use '*' for the ANY side
  4. Pre-validate each entry by replicating the split-on-'<' and length==2 check

Example fix

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

Strategy: validation

Validate before calling

for (String o : props.getProperty("dcoref.optimize.sievesOrder","").split(",")) {
  if (o.trim().split("<").length != 2)
    throw new IllegalArgumentException("Constraint must be 'A<B': " + o);
}

Try / catch

try {
  new SieveCoreferenceSystem(props);
} catch (IllegalArgumentException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Invalid sieve ordering constraint")) {
    logger.warning("Malformed constraint skipped: " + e.getMessage());
    props.setProperty("dcoref.optimize.sievesOrder", sanitizeConstraints(props.getProperty("dcoref.optimize.sievesOrder")));
  } else throw e;
}

Prevention

When it happens

Trigger: Supplying a malformed constraint like 'A' (no '<'), 'A<B<C' (multiple '<'), or whitespace-only/garbled entries in the ordering constraints property; the split on '<' then yields 1 or 3+ parts.

Common situations: Typos when hand-editing the ordering property; list separators (comma vs. some other delimiter) causing entries to glue together; copy-paste introducing extra '<' or newline characters into a constraint.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

    for (int i = 0; i < sieveNames.length; i++) {
      if (sieveNames[i].equals(sieveName)) {
        return i;
      }
    }
    throw new IllegalArgumentException("Invalid sieve name: " + sieveName);
  }

  private static Pair<Integer,Integer> fromSieveOrderConstraintString(String s, String[] sieveNames)
  {
    String[] parts = s.split("<");
    if (parts.length == 2) {
      String first = parts[0].trim();
      String second = parts[1].trim();
      int a = fromSieveNameToIndex(first, sieveNames);
      int b = fromSieveNameToIndex(second, sieveNames);
      return new Pair<>(a, b);
    } else {
      throw new IllegalArgumentException("Invalid sieve ordering constraint: " + s);
    }
  }

  private static String toSieveOrderConstraintString(Pair<Integer,Integer> orderedSieveIndices, String[] sieveNames)
  {
    String first = (orderedSieveIndices.first() < 0)? "*":sieveNames[orderedSieveIndices.first()];
    String second = (orderedSieveIndices.second() < 0)? "*":sieveNames[orderedSieveIndices.second()];
    return first + " < " + second;
  }

  /**
   * Given a set of sieves, select an optimal ordering for the sieves
   * by iterating over sieves, and selecting the one that gives the best score and
   *   adding sieves one at a time until no more sieves left
   */
  public void optimizeSieveOrdering(MentionExtractor mentionExtractor, Properties props, String timestamp) throws Exception
  {
    logger.info("=============SIEVE OPTIMIZATION START ====================");

View on GitHub (pinned to 1b7edd19c4)