{"record":{"id":"5cf7f1c2ab3437ce","repo":"stanfordnlp/CoreNLP","slug":"tokensregexnerannotator-error-invalid-priority-in","errorCode":null,"errorMessage":"TokensRegexNERAnnotator ERROR: Invalid priority in line  in regexner file : \"\"!","messagePattern":"TokensRegexNERAnnotator ERROR: Invalid priority in line  in regexner file : \"\"!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/TokensRegexNERAnnotator.java","lineNumber":776,"sourceCode":"          logger.warn(\"Number in types column for \" + Arrays.toString(key) +\n                  \" is probably priority: \" + split[iOverwrite]);\n        }\n        String[] tempOTs = COMMA_DELIMITERS_PATTERN.split(split[iOverwrite].trim());\n        if (tempOTs.length == 0) {\n          overwritableTypes = Collections.emptySet();\n        } else if (tempOTs.length == 1) {\n          overwritableTypes = Collections.singleton(tempOTs[0]);\n        } else {\n          overwritableTypes = new HashSet<>(Arrays.asList(tempOTs));\n        }\n      } else {\n        overwritableTypes = Collections.emptySet();\n      }\n      if (iPriority >= 0 && split.length > iPriority) {\n        try {\n          priority = Double.parseDouble(split[iPriority].trim());\n        } catch (NumberFormatException e) {\n          throw new IllegalArgumentException(\"TokensRegexNERAnnotator \" + annotatorName\n              + \" ERROR: Invalid priority in line \" + lineCount\n              + \" in regexner file \" + mappingFilename + \": \\\"\" + line + \"\\\"!\", e);\n        }\n      }\n\n      double weight = 0.0;\n      if (iWeight >= 0 && split.length > iWeight) {\n        try {\n          weight = Double.parseDouble(split[iWeight].trim());\n        } catch (NumberFormatException e) {\n          throw new IllegalArgumentException(\"TokensRegexNERAnnotator \" + annotatorName\n              + \" ERROR: Invalid weight in line \" + lineCount\n              + \" in regexner file \" + mappingFilename + \": \\\"\" + line + \"\\\"!\", e);\n        }\n      }\n      int annotateGroup = 0;\n      // Get annotate group from input....\n      if (iGroup>= 0 && split.length > iGroup) {","sourceCodeStart":758,"sourceCodeEnd":794,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/TokensRegexNERAnnotator.java#L758-L794","documentation":"When the header defines a 'priority' column, its value on each line is parsed with Double.parseDouble; a non-numeric value throws IllegalArgumentException showing the line number, mapping file, and line text. Priorities control which rule wins on overlapping matches and must be valid doubles.","triggerScenarios":"A priority column containing text like 'high', '1st', '10%', or a localized decimal comma ('0,5') instead of a plain double such as '1.5'.","commonSituations":"Hand-written rule files with descriptive priorities; copy-pasted rows where a header cell slipped into the data; locale-edited numbers using commas.","solutions":["Replace the priority value on the reported line with a plain double, e.g. 1.0 or 0.","Remove the priority cell (or leave it empty and ensure the column is optional) if you don't need priorities.","Use '.' as the decimal separator, never ','.","Validate the whole file by parsing each priority column with Double.parseDouble in a pre-check script."],"exampleFix":"// before\n[ { word:/CEO/ } ]\tPERSON\thigh\n// after\n[ { word:/CEO/ } ]\tPERSON\t1.0","handlingStrategy":"validation","validationCode":"for (String[] row : rows) {\n  String p = row[iPriority];\n  if (p != null && !p.trim().isEmpty()) Double.parseDouble(p.trim()); // throws before CoreNLP does\n}","typeGuard":null,"tryCatchPattern":"try { annotator = new TokensRegexNERAnnotator(name, props); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Invalid priority\")) { fixPriorityOnLine(e.getMessage()); } else throw e; }","preventionTips":["Write priorities as plain doubles with '.' decimal separators","Never put descriptive labels ('high', 'N/A') in numeric columns","Lint numeric columns with Double.parseDouble in CI before shipping mapping files"],"tags":["nlp","mapping-file","number-format","config-error"],"backgroundTag":"invalid-argument-format","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}