stanfordnlp/CoreNLP · error · IllegalArgumentException
TaggedFileRecord argument
Error message
TaggedFileRecord argument ${arg} has an unexpected number of =s What it means
createRecord() parses the semicolon-separated option list of a tagged file description as key=value pairs using split("=", 2). Each option argument must contain exactly one '='. An argument without '=' (or an empty one) can't be split into key and value, so IllegalArgumentException is thrown naming the offending argument.
Solutions
- Fix the option string so every option is written as key=value, e.g. format=TSV,encoding=UTF-8.
- Remove stray trailing commas or empty options from the semicolon-separated description.
- Spell-check option keys; a value-only token usually means the '=' was dropped.
Example fix
// before -tagger model.gz -testFile "data/test.txt,formatTSV" // after -tagger model.gz -testFile "data/test.txt,format=TSV"
Defensive patterns
Strategy: validation
Validate before calling
// Java: validate description options
boolean ok = arg.contains("=") && arg.indexOf('=') > 0 && arg.length() > arg.indexOf('=') + 1; Prevention
- Always write file description options as key=value.
- Check for stray or trailing commas in semicolon-separated descriptions.
- Unit-test your description strings before launching long training/tagging runs.
When it happens
Trigger: Including a bare token in the tagger's file description (e.g., "/path/file.txt,format=TEXT,badarg" or a trailing comma producing an empty argument) so that arg.split("=",2).length != 2.
Common situations: Typos in command-line testFile descriptions (missing '=' like "formatTEXT"), stray commas creating empty options, or copy-pasted configs where an option's value was deleted.
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
- Unknown argument
- TaggedFileRecord argument
- Unknown argument:
- Unknown argument " + args[argIndex]
- Unknown argument " + args[argIndex]
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/14341efd5bb8251c.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java:172
String[] args = new String[pieces.length - 1];
System.arraycopy(pieces, 0, args, 0, pieces.length - 1);
String file = pieces[pieces.length - 1];
Format format = Format.TEXT;
String encoding = getEncoding(config);
String tagSeparator = getTagSeparator(config);
TreeTransformer treeTransformer = null;
TreeNormalizer treeNormalizer = null;
TreeReaderFactory trf = null;
NumberRangesFileFilter treeRange = null;
Predicate<Tree> treeFilter = null;
Integer wordColumn = null, tagColumn = null;
boolean comments = false;
boolean skipMWT = false;
for (String arg : args) {
String[] argPieces = arg.split("=", 2);
if (argPieces.length != 2) {
throw new IllegalArgumentException("TaggedFileRecord argument " + arg +
" has an unexpected number of =s");
}
if (argPieces[0].equalsIgnoreCase(FORMAT)) {
format = Format.valueOf(argPieces[1]);
} else if (argPieces[0].equalsIgnoreCase(ENCODING)) {
encoding = argPieces[1];
} else if (argPieces[0].equalsIgnoreCase(TAG_SEPARATOR)) {
tagSeparator = argPieces[1];
} else if (argPieces[0].equalsIgnoreCase(TREE_TRANSFORMER)) {
treeTransformer = ReflectionLoading.loadByReflection(argPieces[1]);
} else if (argPieces[0].equalsIgnoreCase(TREE_NORMALIZER)) {
treeNormalizer = ReflectionLoading.loadByReflection(argPieces[1]);
} else if (argPieces[0].equalsIgnoreCase(TREE_READER)) {
trf = ReflectionLoading.loadByReflection(argPieces[1]);
} else if (argPieces[0].equalsIgnoreCase(TREE_RANGE)) {
String range = argPieces[1].replaceAll(":", ",");
treeRange = new NumberRangesFileFilter(range, true);
} else if (argPieces[0].equalsIgnoreCase(TREE_FILTER)) {View on GitHub (pinned to 1b7edd19c4)