{"record":{"id":"99a6f3f122ee3fa3","repo":"stanfordnlp/CoreNLP","slug":"invalid-metrictype-metrictype","errorCode":null,"errorMessage":"Invalid metricType:${metricType}","messagePattern":"Invalid metricType:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java","lineNumber":1526,"sourceCode":"      i++;\n    }\n    metricType = metricType.toLowerCase();\n    if (\"combined\".equals(metricType)) {\n      double finalScore = (scores[0]+scores[1]+scores[3])/3;\n      logger.info(\"Final conll score ((muc+bcub+ceafe)/3) \" + scoreType + \" = \" + finalScore);\n      return finalScore;\n    } else {\n      if (\"bcubed\".equals(metricType)) {\n        metricType = \"bcub\";\n      }\n      for (i = 0; i < names.length; i++) {\n        if (names[i] != null && names[i].equals(metricType)) {\n          double finalScore = scores[i];\n          logger.info(\"Final conll score (\" + metricType + \") \" + scoreType + \" = \" + finalScore);\n          return finalScore;\n        }\n      }\n      throw new IllegalArgumentException(\"Invalid metricType:\" + metricType);\n    }\n  }\n\n  /** Returns final selected score */\n  private double getFinalScore(String metricType, CorefScorer.SubScoreType subScoreType) {\n    metricType = metricType.toLowerCase();\n    int passIndex = sieveClassNames.length - 1;\n    String scoreDesc = metricType;\n    double finalScore;\n    switch (metricType) {\n      case \"combined\":\n        finalScore = (scoreMUC.get(passIndex).getScore(subScoreType)\n            + scoreBcubed.get(passIndex).getScore(subScoreType)\n            + scorePairwise.get(passIndex).getScore(subScoreType)) / 3;\n        scoreDesc = \"(muc + bcub + pairwise)/3\";\n        break;\n      case \"muc\":\n        finalScore = scoreMUC.get(passIndex).getScore(subScoreType);","sourceCodeStart":1508,"sourceCodeEnd":1544,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/dcoref/SieveCoreferenceSystem.java#L1508-L1544","documentation":"SieveCoreferenceSystem score scoring code looks up the requested CoNLL metric type among the known scorer names (e.g. muc, bcub, ceafe, pairwise). If the metricType string (after matching) does not equal any known name, it throws this IllegalArgumentException.","triggerScenarios":"Calling getFinalScore / the scoring entry point with a metricType string that is not one of the recognized scorer names (case matters before/after lowercasing depending on the code path).","commonSituations":"Typo in the scoring metric property (e.g. 'bccub' instead of 'bcub'); passing 'B3' or other aliases not supported by this version; passing a metric name with unexpected case or whitespace.","solutions":["Use one of the supported metric names: muc, bcub, ceafe, pairwise (lowercase)","Trim and lowercase the metric string before passing it","Check the dcoref scoring property (e.g. coref.scores / Conll scored metric) for typos","Consult this CoreNLP version's scorer name list since supported names vary"],"exampleFix":"// before\nString metric = \"BCubed\";\n// after\nString metric = \"bcub\";","handlingStrategy":"validation","validationCode":"Set<String> valid = new HashSet<>(Arrays.asList(\"muc\", \"bcub\", \"ceafe\", \"pairwise\"));\nString m = metricType == null ? null : metricType.trim().toLowerCase();\nif (m == null || !valid.contains(m)) throw new IllegalArgumentException(\"metricType must be one of \" + valid);","typeGuard":null,"tryCatchPattern":"try {\n  double score = system.getFinalScore(metricType, subScoreType);\n} catch (IllegalArgumentException e) {\n  logger.warn(\"Unsupported metricType, falling back to pairwise: \" + e.getMessage());\n  double score = system.getFinalScore(\"pairwise\", subScoreType);\n}","preventionTips":["Use string constants for metric names instead of ad-hoc literals","Lowercase and trim user/config input before passing metric names","Pin the CoreNLP version and check its supported scorer names","Validate scoring config at startup, before long evaluations run"],"tags":["java","illegalargumentexception","dcoref","scoring"],"backgroundTag":"invalid-enum-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"}