{"record":{"id":"b27e4d4b74d9b387","repo":"stanfordnlp/CoreNLP","slug":"unknown-logpriortype","errorCode":null,"errorMessage":"Unknown LogPriorType: ","messagePattern":"Unknown LogPriorType: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/classify/LogPrior.java","lineNumber":28,"sourceCode":" *\n * @author Galen Andrew\n */\npublic class LogPrior implements Serializable {\n\n  private static final long serialVersionUID = 7826853908892790965L;\n\n  public enum LogPriorType { NULL, QUADRATIC, HUBER, QUARTIC, COSH, ADAPT, MULTIPLE_QUADRATIC }\n\n  private static final double LOG2 = Math.log(2);\n  \n  public static LogPriorType getType(String name) {\n    if (name.equalsIgnoreCase(\"null\")) { return LogPriorType.NULL; }\n    else if (name.equalsIgnoreCase(\"quadratic\")) { return LogPriorType.QUADRATIC; }\n    else if (name.equalsIgnoreCase(\"huber\")) { return LogPriorType.HUBER; }\n    else if (name.equalsIgnoreCase(\"quartic\")) { return LogPriorType.QUARTIC; }\n    else if (name.equalsIgnoreCase(\"cosh\")) { return LogPriorType.COSH; }\n//    else if (name.equalsIgnoreCase(\"multiple\")) { return LogPriorType.MULTIPLE; }\n    else { throw new RuntimeException(\"Unknown LogPriorType: \" + name); }\n  }\n\n  // these fields are just for the ADAPT prior -\n  // is there a better way to do this?\n  private double[] means = null;\n  private LogPrior otherPrior = null;\n\n  public static LogPrior getAdaptationPrior(double[] means, LogPrior otherPrior) {\n    LogPrior lp = new LogPrior(LogPriorType.ADAPT);\n    lp.means = means;\n    lp.otherPrior = otherPrior;\n    return lp;\n  }\n\n  public LogPriorType getType() {\n    return type;\n  }\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/classify/LogPrior.java#L10-L46","documentation":"LogPrior.getType(String) maps a prior name string (case-insensitive) to a LogPriorType enum. The library only supports null, quadratic, huber, quartic, and cosh names (the 'multiple' option is commented out); any other string throws this RuntimeException. It is a configuration-lookup guard so an invalid prior name fails fast instead of silently defaulting.","triggerScenarios":"Calling LogPrior.getType(name) with a name other than (case-insensitively) \"null\", \"quadratic\", \"huber\", \"quartic\", or \"cosh\" — typically from a properties file or CLI option like prior=lasso or prior=multiple.","commonSituations":"Copying old Stanford NLP configs that used the removed 'multiple' prior; typos such as 'quadraticc', 'l2', 'gaussian' instead of 'quadratic'; passing null/empty name strings from config parsing.","solutions":["Use one of the supported names: null, quadratic, huber, quartic, or cosh (case-insensitive)","Check the spelling of the prior option in your properties/flags file","If a L1/lasso prior is desired, note it is not selected via getType; use LogPriorType values directly in code","Call LogPrior.logPriorOptions() or inspect the enum to list valid values before configuring"],"exampleFix":"// before\nLogPrior prior = LogPrior.getType(\"lasso\");\n// after\nLogPrior prior = LogPrior.getType(\"quadratic\");","handlingStrategy":"validation","validationCode":"Set<String> ok = new HashSet<>(Arrays.asList(\"null\",\"quadratic\",\"huber\",\"quartic\",\"cosh\"));\nif (priorName == null || !ok.contains(priorName.toLowerCase(Locale.ROOT)))\n  throw new IllegalArgumentException(\"prior must be one of \" + ok + \", got: \" + priorName);","typeGuard":null,"tryCatchPattern":"try {\n  LogPrior prior = LogPrior.getType(name);\n} catch (RuntimeException e) {\n  logger.warn(\"Bad prior name '\" + name + \"', falling back to quadratic\");\n  LogPrior prior = LogPrior.getType(\"quadratic\");\n}","preventionTips":["Keep prior names in a whitelist constant shared with your config validation","Use LogPriorType enum values directly in code instead of strings","Validate all training option strings (Options.parse) before the expensive training run"],"tags":["java","runtimeexception","configuration","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"}