stanfordnlp/CoreNLP · error · IllegalArgumentException
TokensRegexNERAnnotator ERROR: Invalid priority in line in…
Error message
TokensRegexNERAnnotator ERROR: Invalid priority in line in regexner file : ""!
What it means
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.
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.
Example fix
// before
[ { word:/CEO/ } ] PERSON high
// after
[ { word:/CEO/ } ] PERSON 1.0 Defensive patterns
Strategy: validation
Validate before calling
for (String[] row : rows) {
String p = row[iPriority];
if (p != null && !p.trim().isEmpty()) Double.parseDouble(p.trim()); // throws before CoreNLP does
} Try / catch
try { annotator = new TokensRegexNERAnnotator(name, props); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Invalid priority")) { fixPriorityOnLine(e.getMessage()); } else throw e; } Prevention
- 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
When it happens
Trigger: 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'.
Common situations: Hand-written rule files with descriptive priorities; copy-pasted rows where a header cell slipped into the data; locale-edited numbers using commas.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- TokensRegexNERAnnotator ERROR: Invalid group in line in…
- TokensRegexNERAnnotator ERROR: Invalid weight in line in…
- Duplicate header field:
- Invalid match group for entry
- TokensRegexNERAnnotator ERROR: Header does not contain…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/5cf7f1c2ab3437ce.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/TokensRegexNERAnnotator.java:776
logger.warn("Number in types column for " + Arrays.toString(key) +
" is probably priority: " + split[iOverwrite]);
}
String[] tempOTs = COMMA_DELIMITERS_PATTERN.split(split[iOverwrite].trim());
if (tempOTs.length == 0) {
overwritableTypes = Collections.emptySet();
} else if (tempOTs.length == 1) {
overwritableTypes = Collections.singleton(tempOTs[0]);
} else {
overwritableTypes = new HashSet<>(Arrays.asList(tempOTs));
}
} else {
overwritableTypes = Collections.emptySet();
}
if (iPriority >= 0 && split.length > iPriority) {
try {
priority = Double.parseDouble(split[iPriority].trim());
} catch (NumberFormatException e) {
throw new IllegalArgumentException("TokensRegexNERAnnotator " + annotatorName
+ " ERROR: Invalid priority in line " + lineCount
+ " in regexner file " + mappingFilename + ": \"" + line + "\"!", e);
}
}
double weight = 0.0;
if (iWeight >= 0 && split.length > iWeight) {
try {
weight = Double.parseDouble(split[iWeight].trim());
} catch (NumberFormatException e) {
throw new IllegalArgumentException("TokensRegexNERAnnotator " + annotatorName
+ " ERROR: Invalid weight in line " + lineCount
+ " in regexner file " + mappingFilename + ": \"" + line + "\"!", e);
}
}
int annotateGroup = 0;
// Get annotate group from input....
if (iGroup>= 0 && split.length > iGroup) {View on GitHub (pinned to 1b7edd19c4)