{"record":{"id":"44358c6d16f38614","repo":"stanfordnlp/CoreNLP","slug":"unknown-format-format","errorCode":null,"errorMessage":"Unknown format ${format}","messagePattern":"Unknown format (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java","lineNumber":130,"sourceCode":"    }\n    if (skipMWT) {\n      s.append(\",\" + SKIP_MWT + \"=true\");\n    }\n    return s.toString();\n  }\n\n  public String filename() { return file; }\n\n  public TaggedFileReader reader() {\n    switch(format) {\n    case TEXT:\n      return new TextTaggedFileReader(this);\n    case TREES:\n      return new TreeTaggedFileReader(this);\n    case TSV:\n      return new TSVTaggedFileReader(this);\n    default:\n      throw new IllegalArgumentException(\"Unknown format \" + format);\n    }\n  }\n\n  public static List<TaggedFileRecord> createRecords(Properties config,\n                                                     String description) {\n    String[] pieces = description.split(\";\");\n    List<TaggedFileRecord> records = new ArrayList<>();\n    for (String piece : pieces) {\n      records.add(createRecord(config, piece));\n    }\n    return records;\n  }\n\n  public static TaggedFileRecord createRecord(Properties config,\n                                              String description) {\n    String[] pieces = description.split(\",\");\n    if (pieces.length == 1) {\n      return new TaggedFileRecord(description, Format.TEXT,","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/tagger/io/TaggedFileRecord.java#L112-L148","documentation":"TaggedFileRecord.reader() switches on the configured Format enum (TEXT, TREES, TSV) to create the matching file reader. If the stored format value isn't one of the known enum cases, the default branch throws IllegalArgumentException. This normally can't happen via Format.valueOf, but can arise from a manually constructed record or an enum added without updating reader().","triggerScenarios":"Constructing a TaggedFileRecord with a Format value not handled by reader()'s switch (e.g., a newer enum constant used with an older switch, or a null/unmapped format passed programmatically), typically reached via runTagger, countSentences, or TaggedFileRecord.createRecords.","commonSituations":"Version mismatch between the tagger jar and code referencing a newer Format constant; programmatic construction of TaggedFileRecord with an invalid format; typos in a custom config path that bypasses valueOf validation.","solutions":["Set the format to one of the supported values: format=TEXT, format=TREES, or format=TSV in the file description string.","Upgrade or align your Stanford POS tagger library version so enum constants and reader() agree.","If constructing TaggedFileRecord programmatically, pass a valid Format enum constant."],"exampleFix":"// before\nTaggedFileRecord.record(\"data/test.txt\").setFormat(\"XML\").build();\n// after\nTaggedFileRecord.record(\"data/test.txt\").setFormat(\"TEXT\").build();","handlingStrategy":"validation","validationCode":"// Java\nSet<String> allowed = Set.of(\"TEXT\", \"TREES\", \"TSV\");\nboolean ok = allowed.contains(formatString.toUpperCase(Locale.ROOT));","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n  reader = record.reader();\n} catch (IllegalArgumentException e) {\n  throw new ConfigException(\"Unsupported format: use TEXT, TREES, or TSV\", e);\n}","preventionTips":["Use only documented format values: TEXT, TREES, TSV.","Keep the tagger library version consistent across your build.","Prefer createRecords()/TaggedFileSpec builders over manual TaggedFileRecord construction."],"tags":["nlp","pos-tagger","config","enum"],"backgroundTag":"invalid-enum-value","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"}