{"record":{"id":"dfcd2ac560dc39f3","repo":"stanfordnlp/CoreNLP","slug":"model-location-not-specified-for-true-case-classif","errorCode":null,"errorMessage":"Model location not specified for true-case classifier!","messagePattern":"Model location not specified for true-case classifier!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/TrueCaseAnnotator.java","lineNumber":76,"sourceCode":"\n  public TrueCaseAnnotator(String modelLoc,\n                           String classBias,\n                           String mixedCaseFileName,\n                           boolean overwriteText,\n                           boolean verbose) {\n    this.overwriteText = overwriteText;\n    this.verbose = verbose;\n\n    Properties props = PropertiesUtils.asProperties(\n            \"loadClassifier\", modelLoc,\n            \"mixedCaseMapFile\", mixedCaseFileName,\n            \"classBias\", classBias);\n    trueCaser = new CRFBiasedClassifier<>(props);\n\n    if (modelLoc != null) {\n      trueCaser.loadClassifierNoExceptions(modelLoc, props);\n    } else {\n      throw new RuntimeException(\"Model location not specified for true-case classifier!\");\n    }\n\n    if (classBias != null) {\n      StringTokenizer biases = new java.util.StringTokenizer(classBias,\",\");\n      while (biases.hasMoreTokens()) {\n        StringTokenizer bias = new java.util.StringTokenizer(biases.nextToken(),\":\");\n        String cname = bias.nextToken();\n        double w = Double.parseDouble(bias.nextToken());\n        trueCaser.setBiasWeight(cname,w);\n        if (this.verbose) log.info(\"Setting bias for class \" + cname + \" to \" + w);\n      }\n    }\n\n    // Load map containing mixed-case words:\n    // TODO:\n    // this file has some weirdness in it\n    // for example, 4 different interpretations of el-:\n    //   EL-Dafla, el-Ela, El-Ein, EL-ALY","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/TrueCaseAnnotator.java#L58-L94","documentation":"TrueCaseAnnotator's constructor resolves the true-case CRF classifier model from the 'truecase.model' property (defaulting to the bundled English model). If the resolved model location is null, it throws this RuntimeException while building the pipeline.","triggerScenarios":"Constructing a TrueCaseAnnotator or requesting annotator 'truecase' with a properties object where truecase.model is set to an empty string or otherwise resolves to null, so no model path exists to load.","commonSituations":"Overriding 'truecase.model' with an empty value in a properties file, copying a partial property subset that drops the default, or programmatic Properties construction that blanks the key.","solutions":["Set a valid 'truecase.model' property pointing at the classifier model file (e.g. the bundled English truecase model)","Remove the empty/incorrect 'truecase.model' override so the built-in default model path is used","Verify the property key spelling — a typo key like 'truecase.model ' (trailing space) can yield a null/blank resolution","Ensure the model file exists at the given path (classpath or filesystem) before constructing the annotator"],"exampleFix":"// before\nProperties props = new Properties();\nprops.setProperty(\"truecase.model\", \"\");\n// after\nProperties props = new Properties();\nprops.setProperty(\"truecase.model\", \"edu/stanford/nlp/models/truecase/EnglishAll.untaased.caseless.ser.gz\");","handlingStrategy":"validation","validationCode":"String modelLoc = props.getProperty(\"truecase.model\", DEFAULT_TRUECASE_MODEL);\nif (modelLoc == null || modelLoc.trim().isEmpty())\n  throw new IllegalStateException(\"truecase.model must point to a classifier model file\");\nif (!new java.io.File(modelLoc).exists() && getClass().getResource(\"/\" + modelLoc) == null)\n  throw new IllegalStateException(\"Truecase model not found: \" + modelLoc);","typeGuard":null,"tryCatchPattern":"try {\n  annotators.add(new TrueCaseAnnotator(props));\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"Model location not specified\")) {\n    log.error(\"Set 'truecase.model' to a valid model path or remove the empty override\");\n  }\n  throw e;\n}","preventionTips":["Never set truecase.model to an empty string; omit the key to use the default","Verify model file existence (filesystem or classpath) before constructing the pipeline","Centralize model path constants to avoid typos in keys","Test pipeline construction in CI so missing models fail early"],"tags":["configuration","truecase","model-loading"],"backgroundTag":"missing-required-config-value","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"}