stanfordnlp/CoreNLP · error · IllegalArgumentException

TaggedFileRecord argument

Error message

TaggedFileRecord argument ${argPieces[0]} is unknown

What it means

After splitting each option into key=value, createRecord() matches the key against the known option names (format, encoding, tagSeparator, treeTransformer, treeNormalizer, tagger Training parameters, treeRange, treeFilter, wordColumn, tagColumn, comments, skipMWT). Any key that matches none of them triggers IllegalArgumentException naming the unknown option.

Solutions

  1. Replace the unknown key with a supported one: format, encoding, tagSeparator, treeTransformer, treeNormalizer, treeRange, treeFilter, wordColumn, tagColumn, comments, or skipMWT.
  2. Check spelling exactly (case-insensitive): e.g. 'tagSeparator' not 'tagSeperator'.
  3. Consult the TaggedFileRecord javadoc for your library version; some options (wordColumn, skipMWT) exist only in newer releases.

Example fix

// before
-testFile "data/test.txt,fmt=TSV,tagSeperator=_"
// after
-testFile "data/test.txt,format=TSV,tagSeparator=_"
Defensive patterns

Strategy: validation

Validate before calling

// Java
Set<String> known = Set.of("format","encoding","tagseparator","treetransformer",
  "treenormalizer","treebanklanguagepack","treerange","treefilter","taggertrainingfile",
  "wordcolumn","tagcolumn","comments","skipmwt");
boolean ok = known.contains(key.toLowerCase(Locale.ROOT));

Prevention

When it happens

Trigger: Passing an option key that isn't one of the recognized TaggedFileRecord option names in the file description string, e.g. "data/file.txt,fmt=TSV" or a misspelling like "tagSeperator=_".

Common situations: Misspelled option names in testFile/trainFile descriptions, copying options valid for other tools into this description, or inventing options that don't exist in your tagger version.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/0ca899c7731ff24f. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java:201

      } 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)) {
        treeFilter = ReflectionLoading.loadByReflection(argPieces[1]);
      } else if (argPieces[0].equalsIgnoreCase(WORD_COLUMN)) {
        wordColumn = Integer.valueOf(argPieces[1]);
      } else if (argPieces[0].equalsIgnoreCase(TAG_COLUMN)) {
        tagColumn = Integer.valueOf(argPieces[1]);
      } else if (argPieces[0].equalsIgnoreCase(COMMENTS)) {
        comments = Boolean.valueOf(argPieces[1]);
      } else if (argPieces[0].equalsIgnoreCase(SKIP_MWT)) {
        skipMWT = Boolean.valueOf(argPieces[1]);
      } else {
        throw new IllegalArgumentException("TaggedFileRecord argument " +
                                           argPieces[0] + " is unknown");
      }
    }
    return new TaggedFileRecord(file, format, encoding, tagSeparator,
                                treeTransformer, treeNormalizer, trf, treeRange,
                                treeFilter, wordColumn, tagColumn, comments, skipMWT);
  }

  public static String getEncoding(Properties config) {
    String encoding = config.getProperty(TaggerConfig.ENCODING_PROPERTY);
    if (encoding == null)
      return TaggerConfig.ENCODING;
    return encoding;
  }

  public static String getTagSeparator(Properties config) {
    String tagSeparator =
      config.getProperty(TaggerConfig.TAG_SEPARATOR_PROPERTY);

View on GitHub (pinned to 1b7edd19c4)