{"record":{"id":"14341efd5bb8251c","repo":"stanfordnlp/CoreNLP","slug":"taggedfilerecord-argument-arg-has-an-unexpected","errorCode":null,"errorMessage":"TaggedFileRecord argument ${arg} has an unexpected number of =s","messagePattern":"TaggedFileRecord argument (.+?) has an unexpected number of =s","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java","lineNumber":172,"sourceCode":"    String[] args = new String[pieces.length - 1];\n    System.arraycopy(pieces, 0, args, 0, pieces.length - 1);\n    String file = pieces[pieces.length - 1];\n    Format format = Format.TEXT;\n    String encoding = getEncoding(config);\n    String tagSeparator = getTagSeparator(config);\n    TreeTransformer treeTransformer = null;\n    TreeNormalizer treeNormalizer = null;\n    TreeReaderFactory trf = null;\n    NumberRangesFileFilter treeRange = null;\n    Predicate<Tree> treeFilter = null;\n    Integer wordColumn = null, tagColumn = null;\n    boolean comments = false;\n    boolean skipMWT = false;\n\n    for (String arg : args) {\n      String[] argPieces = arg.split(\"=\", 2);\n      if (argPieces.length != 2) {\n        throw new IllegalArgumentException(\"TaggedFileRecord argument \" + arg +\n                                           \" has an unexpected number of =s\");\n      }\n      if (argPieces[0].equalsIgnoreCase(FORMAT)) {\n        format = Format.valueOf(argPieces[1]);\n      } else if (argPieces[0].equalsIgnoreCase(ENCODING)) {\n        encoding = argPieces[1];\n      } else if (argPieces[0].equalsIgnoreCase(TAG_SEPARATOR)) {\n        tagSeparator = argPieces[1];\n      } else if (argPieces[0].equalsIgnoreCase(TREE_TRANSFORMER)) {\n        treeTransformer = ReflectionLoading.loadByReflection(argPieces[1]);\n      } else if (argPieces[0].equalsIgnoreCase(TREE_NORMALIZER)) {\n        treeNormalizer = ReflectionLoading.loadByReflection(argPieces[1]);\n      } else if (argPieces[0].equalsIgnoreCase(TREE_READER)) {\n        trf = ReflectionLoading.loadByReflection(argPieces[1]);\n      } else if (argPieces[0].equalsIgnoreCase(TREE_RANGE)) {\n        String range = argPieces[1].replaceAll(\":\", \",\");\n        treeRange = new NumberRangesFileFilter(range, true);\n      } else if (argPieces[0].equalsIgnoreCase(TREE_FILTER)) {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java#L154-L190","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n-tagger model.gz -testFile \"data/test.txt,formatTSV\"\n// after\n-tagger model.gz -testFile \"data/test.txt,format=TSV\"","handlingStrategy":"validation","validationCode":"// Java: validate description options\nboolean ok = arg.contains(\"=\") && arg.indexOf('=') > 0 && arg.length() > arg.indexOf('=') + 1;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["nlp","pos-tagger","cli","argument-parsing"],"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-15T23:17:13.987Z"}