{"record":{"id":"4fe42666696c1324","repo":"stanfordnlp/CoreNLP","slug":"invalid-ordering-constraint-ordering","errorCode":null,"errorMessage":"Invalid ordering constraint: ${ordering}","messagePattern":"Invalid ordering constraint: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java","lineNumber":256,"sourceCode":"    if (!optimizeMetricTypeOk) {\n      throw new IllegalArgumentException(\"Invalid metric type for \" +\n              Constants.OPTIMIZE_SIEVES_SCORE_PROP + \" property: \" + optimizeScoreType);\n    }\n    optimizeSubScoreType = CorefScorer.SubScoreType.valueOf(parts[1]);\n\n    if (optimizeSieves) {\n      String keepSieveOrder = props.getProperty(Constants.OPTIMIZE_SIEVES_KEEP_ORDER_PROP);\n      if (keepSieveOrder != null) {\n        String[] orderings = keepSieveOrder.split(\"\\\\s*,\\\\s*\");\n        sievesKeepOrder = new ArrayList<>();\n        String firstSieveConstraint = null;\n        String lastSieveConstraint = null;\n        for (String ordering:orderings) {\n          // Convert ordering constraints from string\n          Pair<Integer,Integer> p = fromSieveOrderConstraintString(ordering, sieveClassNames);\n          // Do initial check of sieves order, can only have one where the first is ANY (< 0), and one where second is ANY (< 0)\n          if (p.first() < 0 && p.second() < 0) {\n            throw new IllegalArgumentException(\"Invalid ordering constraint: \" + ordering);\n          } else if (p.first() < 0) {\n            if (lastSieveConstraint != null) {\n              throw new IllegalArgumentException(\"Cannot have these two ordering constraints: \" + lastSieveConstraint + \",\" + ordering);\n            }\n            lastSieveConstraint = ordering;\n          } else if (p.second() < 0) {\n            if (firstSieveConstraint != null) {\n              throw new IllegalArgumentException(\"Cannot have these two ordering constraints: \" + firstSieveConstraint + \",\" + ordering);\n            }\n            firstSieveConstraint = ordering;\n          }\n          sievesKeepOrder.add(p);\n        }\n      }\n    }\n\n    if(doScore){\n      initScorers();","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java#L238-L274","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ndcoref.optimize.sievesOrder = *<*, MentionExtract<*\n// after\ndcoref.optimize.sievesOrder = *<MentionExtract, ExactStringMatch< ProperNounMatch","handlingStrategy":"validation","validationCode":"String[] orderings = props.getProperty(\"dcoref.optimize.sievesOrder\",\"\").split(\",\");\nfor (String o : orderings) {\n  String[] sides = o.split(\"<\");\n  if (sides.length == 2 && sides[0].trim().equals(\"*\") && sides[1].trim().equals(\"*\"))\n    throw new IllegalArgumentException(\"Useless constraint: \" + o);\n}","typeGuard":null,"tryCatchPattern":"try {\n  SieveCoreferenceSystem corefSystem = new SieveCoreferenceSystem(props);\n} catch (IllegalArgumentException e) {\n  logger.warning(\"Bad ordering constraint, ignoring sieve-order optimization: \" + e.getMessage());\n  props.remove(\"dcoref.optimize.sievesOrder\");\n  corefSystem = new SieveCoreferenceSystem(props);\n}","preventionTips":["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)"],"tags":["corenlp","coreference","configuration","ordering-constraints"],"backgroundTag":"invalid-config-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}