{"record":{"id":"68090f98c034ba10","repo":"stanfordnlp/CoreNLP","slug":"cannot-have-these-two-ordering-constraints-firs","errorCode":null,"errorMessage":"Cannot have these two ordering constraints: ${firstSieveConstraint},${ordering}","messagePattern":"Cannot have these two ordering constraints: (.+?),(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java","lineNumber":264,"sourceCode":"      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();\n    }\n\n    //\n    // load all dictionaries\n    //\n    dictionaries = new Dictionaries(props);\n    semantics = (useSemantics)? new Semantics(dictionaries) : null;\n","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java#L246-L282","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Keep at most one constraint of the form 'SieveName<*' in the ordering property","Rewrite one of the conflicting constraints with explicit sieve names on both sides","Use the exception message to identify which two constraints conflict and remove one","Pre-validate constraints: count ANY-first (first<0) and ANY-second (second<0) entries, each must be <=1"],"exampleFix":"// before\ndcoref.optimize.sievesOrder = ExactStringMatch<*, ProperNounMatch<*\n// after\ndcoref.optimize.sievesOrder = ExactStringMatch<*, ProperNounMatch<ExactStringMatch","handlingStrategy":"validation","validationCode":"String[] orderings = props.getProperty(\"dcoref.optimize.sievesOrder\",\"\").split(\",\");\nint anySecond = 0;\nfor (String o : orderings) {\n  String[] sides = o.split(\"<\");\n  if (sides.length == 2 && sides[1].trim().equals(\"*\") && ++anySecond > 1)\n    throw new IllegalArgumentException(\"Only one 'X<*' allowed: \" + o);\n}","typeGuard":null,"tryCatchPattern":"try {\n  new SieveCoreferenceSystem(props);\n} catch (IllegalArgumentException e) {\n  logger.severe(\"Constraint conflict: \" + e.getMessage());\n  // remove one of the 'X<*' constraints named in the message and retry\n}","preventionTips":["Enforce 'at most one X<* constraint' in config generators and linters","Use wildcard constraints sparingly; prefer explicit sieve pairs","Validate both ANY-first and ANY-second counts together before running"],"tags":["corenlp","coreference","configuration","ordering-constraints"],"backgroundTag":"conflicting-config-options","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"}