{"record":{"id":"e87a78b4680e87ed","repo":"stanfordnlp/CoreNLP","slug":"unable-to-find-sieve-ordering-to-satisfy-all-order","errorCode":null,"errorMessage":"Unable to find sieve ordering to satisfy all ordering constraints!!!!","messagePattern":"Unable to find sieve ordering to satisfy all ordering constraints!!!!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java","lineNumber":688,"sourceCode":"              break;\n            }\n          } else if (ko.first() < 0 && remainingSieveIndices.size() > 1) {\n            if (remainingSieveIndices.contains(ko.second())) {\n              logger.info(\"Remove selection \" + origSieveNames[ko.second()] + \" because of constraint \" +\n                    toSieveOrderConstraintString(ko, origSieveNames));\n              selectableSieveIndices.remove(ko.second());\n            }\n          } else if (remainingSieveIndices.contains(ko.first())) {\n            if (remainingSieveIndices.contains(ko.second())) {\n              logger.info(\"Remove selection \" + origSieveNames[ko.second()] + \" because of constraint \" +\n                    toSieveOrderConstraintString(ko, origSieveNames));\n              selectableSieveIndices.remove(ko.second());\n            }\n          }\n        }\n      }\n      if (selectableSieveIndices.isEmpty()) {\n        throw new RuntimeException(\"Unable to find sieve ordering to satisfy all ordering constraints!!!!\");\n      }\n\n      int selected = -1;\n      if (selectableSieveIndices.size() > 1) {\n        // Go through remaining sieves and see how well they do\n        List<Pair<Double,Integer>> scores = new ArrayList<>();\n        if (runDistributedCmd != null) {\n          String workDirPath = mainWorkDirPath + curSievesNumber + File.separator;\n          File workDir = new File(workDirPath);\n          workDir.mkdirs();\n          workDirPath = workDir.getAbsolutePath() + File.separator;\n          // Start jobs\n          for (int potentialSieveIndex:selectableSieveIndices) {\n            String sieveSelectionId = curSievesNumber + \".\" + potentialSieveIndex;\n            String jobDirPath = workDirPath + sieveSelectionId + File.separator;\n            File jobDir = new File(jobDirPath);\n            jobDir.mkdirs();\n            Properties newProps = new Properties();","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java#L670-L706","documentation":"When optimizing the sieve order, the system greedily builds a total order: at each position it computes the set of sieve indices allowed by the remaining ordering constraints (selectableSieveIndices) and picks one. If this set becomes empty before all sieves are placed, the constraints are unsatisfiable and a RuntimeException 'Unable to find sieve ordering to satisfy all ordering constraints!!!!' is thrown.","triggerScenarios":"Configuring an ordering-constraints set that forms a cycle or otherwise admits no valid total order — e.g. A<B, B<C, C<A — so that after placing some sieves no remaining sieve satisfies all keepOrder constraints.","commonSituations":"Adding many pairwise constraints over time that silently introduce a cycle; combining one ANY-first and one ANY-second constraint with contradictory pairwise constraints; generated constraints from an automated tuner with a logic bug.","solutions":["Check the ordering constraints for cycles (e.g. A<B, B<C, C<A) and remove/reverse one to break the loop","Reduce the constraint set to a minimal consistent subset and re-run to isolate the conflict","Draw the constraints as a directed graph and verify it is a DAG before configuring","Use fewer or looser constraints (replace explicit pairs with the allowed single '*<' and '<*' wildcards)"],"exampleFix":"// before\ndcoref.optimize.sievesOrder = A<B, B<C, C<A   // cycle: unsatisfiable\n// after\ndcoref.optimize.sievesOrder = A<B, B<C","handlingStrategy":"validation","validationCode":"// verify constraints are acyclic before running\nMap<String,List<String>> g = new HashMap<>();\nfor (String o : props.getProperty(\"dcoref.optimize.sievesOrder\",\"\").split(\",\")) {\n  String[] s = o.split(\"<\");\n  if (s.length==2 && !s[0].trim().equals(\"*\") && !s[1].trim().equals(\"*\"))\n    g.computeIfAbsent(s[0].trim(), k->new ArrayList<>()).add(s[1].trim());\n}\n// topological sort; failure => cycle => would throw at runtime","typeGuard":null,"tryCatchPattern":"try {\n  SieveCoreferenceSystem coref = new SieveCoreferenceSystem(props);\n  coref.runCoref(docReader);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Unable to find sieve ordering\")) {\n    logger.severe(\"Constraints unsatisfiable (likely a cycle). Reducing constraint set.\");\n    props.setProperty(\"dcoref.optimize.sievesOrder\", minimalConstraints);\n  } else throw e;\n}","preventionTips":["Check the constraint graph for cycles whenever you add a new pair","Keep the constraint set minimal; prefer wildcards over many pairwise rules","Run a quick smoke-test of sieve optimization on a small corpus before full runs","Document each constraint's rationale so obsolete conflicting ones get removed"],"tags":["corenlp","coreference","configuration","unsatisfiable-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"}