{"record":{"id":"d94c11133d0bfdad","repo":"stanfordnlp/CoreNLP","slug":"invalid-metric-type-for-constants-optimize-sieve","errorCode":null,"errorMessage":"Invalid metric type for ${Constants.OPTIMIZE_SIEVES_SCORE_PROP} property: ${optimizeScoreType}","messagePattern":"Invalid metric type for (.+?) property: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java","lineNumber":239,"sourceCode":"\n    // flag for optimizing sieve ordering\n    optimizeSieves = Boolean.parseBoolean(props.getProperty(Constants.OPTIMIZE_SIEVES_PROP, \"false\"));\n    optimizeScoreType = props.getProperty(Constants.OPTIMIZE_SIEVES_SCORE_PROP, \"pairwise.Precision\");\n\n    // Break down of the optimize score type\n    String[] validMetricTypes = { \"muc\", \"pairwise\", \"bcub\", \"ceafe\", \"ceafm\", \"combined\" };\n    String[] parts = optimizeScoreType.split(\"\\\\.\");\n    optimizeConllScore = parts.length > 2 && \"conll\".equalsIgnoreCase(parts[2]);\n    optimizeMetricType = parts[0];\n    boolean optimizeMetricTypeOk = false;\n    for (String validMetricType : validMetricTypes) {\n      if (validMetricType.equalsIgnoreCase(optimizeMetricType)) {\n        optimizeMetricTypeOk = true;\n        break;\n      }\n    }\n    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) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java#L221-L257","documentation":"The SieveCoreferenceSystem constructor validates the metric named by the Constants.OPTIMIZE_SIEVES_SCORE_PROP property against the list of valid scorer metric types. If the configured optimizeScoreType (or its metric part) is not a recognized coref scoring metric such as muc, bcub, ceafe or ceafm, it throws an IllegalArgumentException before the system is built.","triggerScenarios":"Setting the property dcoref.optimize.sievesScore (OPTIMIZE_SIEVES_SCORE_PROP) to a metric string not in the valid set — e.g. a misspelled name, wrong case, or a subscore format like 'pairwise.foo' whose first part doesn't match a valid metric — while sieve optimization (optimizeSieves) is enabled.","commonSituations":"Typos in a coref tuning properties file (e.g. 'bcube' instead of 'bcub'); copying config between CoreNLP versions where the accepted metric list changed; forgetting that combined SubScoreType values must parse via CorefScorer.SubScoreType.valueOf(parts[1]).","solutions":["Set the property to a valid metric name exactly as accepted by the system (muc, bcub, ceafe, ceafm, etc.)","Check spelling and case against the validMetricType list used in the validation loop","If using a subscore form, ensure the part after the separator is a valid CorefScorer.SubScoreType enum constant","Consult the Constants class / CorefScorer source for the exact accepted metric strings in your CoreNLP version"],"exampleFix":"// before\ncoref.props: dcoref.optimize.sievesScore = bcube\n// after\ncoref.props: dcoref.optimize.sievesScore = bcub","handlingStrategy":"validation","validationCode":"Set<String> valid = new HashSet<>(Arrays.asList(\"muc\",\"bcub\",\"ceafe\",\"ceafm\"));\nString score = props.getProperty(\"dcoref.optimize.sievesScore\");\nif (score != null && !valid.contains(score.split(\"\\\\.\")[0])) {\n  throw new IllegalArgumentException(\"Unknown metric: \" + score);\n}","typeGuard":null,"tryCatchPattern":"try {\n  SieveCoreferenceSystem corefSystem = new SieveCoreferenceSystem(props);\n} catch (IllegalArgumentException e) {\n  logger.severe(\"Bad optimize metric config: \" + e.getMessage());\n  props.setProperty(Constants.OPTIMIZE_SIEVES_SCORE_PROP, \"bcub\"); // fall back to default\n}","preventionTips":["Copy metric names verbatim from Constants/CorefScorer documentation","Use a shared constants file for metric names instead of inline strings in props","Keep a minimal known-good coref properties file as a template","Diff your props against upstream example configs after upgrading CoreNLP"],"tags":["corenlp","coreference","configuration","invalid-metric"],"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"}