{"record":{"id":"25f2584debd0d461","repo":"stanfordnlp/CoreNLP","slug":"wrong-format","errorCode":null,"errorMessage":"Wrong format: ","messagePattern":"Wrong format: ","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/TrueCaseAnnotator.java","lineNumber":167,"sourceCode":"    }\n    // System.err.println(text + \" was classified as \" + trueCase + \" and so became \" + trueCaseText);\n\n    l.set(CoreAnnotations.TrueCaseTextAnnotation.class, trueCaseText);\n\n    if (overwriteText) {\n      l.set(CoreAnnotations.TextAnnotation.class, trueCaseText);\n      l.set(CoreAnnotations.ValueAnnotation.class, trueCaseText);\n    }\n  }\n\n  private static Map<String,String> loadMixedCaseMap(String mapFile) {\n    Map<String,String> map = Generics.newHashMap();\n    try (BufferedReader br = IOUtils.readerFromString(mapFile)) {\n      for (String line : ObjectBank.getLineIterator(br)) {\n        line = line.trim();\n        String[] els = line.split(\"\\\\s+\");\n        if (els.length != 2) {\n          throw new RuntimeException(\"Wrong format: \" + mapFile);\n        }\n        map.put(els[0], els[1]);\n      }\n    } catch (IOException e) {\n      throw new RuntimeIOException(e);\n    }\n    return map;\n  }\n\n  @Override\n  public Set<Class<? extends CoreAnnotation>> requires() {\n    return Collections.unmodifiableSet(new ArraySet<>(Arrays.asList(\n        CoreAnnotations.TextAnnotation.class,\n        CoreAnnotations.TokensAnnotation.class,\n        CoreAnnotations.PositionAnnotation.class,\n        CoreAnnotations.SentencesAnnotation.class\n    )));\n  }","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/TrueCaseAnnotator.java#L149-L185","documentation":"TrueCaseAnnotator.loadMixedCaseMap loads the mixed-case word map ('truecase.mixedcasefile'). Each non-empty line must contain exactly two whitespace-separated tokens: the word and its true-cased form. Any line with a different token count causes this RuntimeException identifying the map file.","triggerScenarios":"A mixed-case map file where some line splits into more or fewer than 2 whitespace-separated fields — e.g. a line with trailing comment text, multiple words per line, or blank-ish lines with stray tokens.","commonSituations":"Hand-built or machine-generated map files with comments ('# entry extra'), tabs plus spaces combining into >2 fields, or lines where the true-case form itself contains spaces.","solutions":["Edit the map file so every line has exactly two fields: word<TAB or space>truecased-form","Remove comment lines or inline comments — the loader does not strip them","Replace multi-word true-case values with single tokens or underscores","Check for double spaces/tabs that inflate the split count on some lines"],"exampleFix":"// before (mixedcase map line)\niphone iPhone the sequel\n// after\niphone\tiPhone","handlingStrategy":"validation","validationCode":"// Validate mixed-case map file lines before use\ntry (BufferedReader br = Files.newBufferedReader(Paths.get(mapFile))) {\n  int lineNo = 0;\n  for (String line : (Iterable<String>) br.lines()::iterator) {\n    lineNo++;\n    if (!line.trim().isEmpty() && line.trim().split(\"\\\\s+\").length != 2)\n      throw new IllegalStateException(mapFile + \":\" + lineNo + \" must have exactly 2 fields\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline = new StanfordCoreNLP(props);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Wrong format:\")) {\n    log.error(\"Mixed-case map file lines must be 'word truecasedForm': \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["Use a single tab between the two fields and no comments in the map file","Keep true-case values as single tokens (no spaces)","Lint map files in CI: every non-empty line must split into exactly 2 fields","Generate map files programmatically instead of by hand"],"tags":["file-format","truecase","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-17T15:17:12.973Z"}