{"record":{"id":"31937e1e092fe08e","repo":"stanfordnlp/CoreNLP","slug":"unsupported-inference-type-flags-crftype","errorCode":null,"errorMessage":"Unsupported inference type: \" + flags.crfType","messagePattern":"Unsupported inference type: \" \\+ flags\\.crfType","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/ie/crf/CRFClassifier.java","lineNumber":1070,"sourceCode":"      CRFFeatureExporter<IN> featureExporter = new CRFFeatureExporter<>(this);\n      featureExporter.printFeatures(flags.exportFeatures, docs);\n      long elapsedMs = timer.stop();\n      log.info(\"Time to export features: \" + Timing.toSecondsString(elapsedMs) + \" seconds\");\n    }\n  }\n\n  @Override\n  public List<IN> classify(List<IN> document) {\n    if (flags.doGibbs) {\n      try {\n        return classifyGibbs(document);\n      } catch (Exception e) {\n        throw new RuntimeException(\"Error running testGibbs inference!\", e);\n      }\n    } else if (flags.crfType.equalsIgnoreCase(\"maxent\")) {\n      return classifyMaxEnt(document);\n    } else {\n      throw new RuntimeException(\"Unsupported inference type: \" + flags.crfType);\n    }\n  }\n\n  private List<IN> classify(List<IN> document, Triple<int[][][], int[], double[][][]> documentDataAndLabels) {\n    if (flags.doGibbs) {\n      try {\n        return classifyGibbs(document, documentDataAndLabels);\n      } catch (Exception e) {\n        throw new RuntimeException(\"Error running testGibbs inference!\", e);\n      }\n    } else if (flags.crfType.equalsIgnoreCase(\"maxent\")) {\n      return classifyMaxEnt(document, documentDataAndLabels);\n    } else {\n      throw new RuntimeException(\"Unsupported inference type: \" + flags.crfType);\n    }\n  }\n\n  /**","sourceCodeStart":1052,"sourceCodeEnd":1088,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ie/crf/CRFClassifier.java#L1052-L1088","documentation":"classify() dispatches inference by flags.crfType: only \"maxent\" (and optionally \"cpc\" in other paths) is supported. If crfType holds any other value while doGibbs is false, the classifier doesn't know which inference procedure to run and throws a RuntimeException naming the unknown type.","triggerScenarios":"Calling classify(document) with flags.doGibbs=false and flags.crfType set to something other than \"maxent\" (case-insensitive), e.g. a typo like \"maxent2\" or a type only valid in newer/older code versions.","commonSituations":"Copying crfType values from blog posts or older Stanford code; serialized model flags carrying a crfType the current jar doesn't implement; typos in a properties file.","solutions":["Set crfType to \"maxent\" (the standard value) in your training/classification properties.","If the value came from a serialized model, retrain or edit the flags to a supported type.","If Gibbs inference was intended, set doGibbs=true instead of inventing a crfType value."],"exampleFix":"// before\nprops.setProperty(\"crfType\", \"maxent-logistic\");\n// after\nprops.setProperty(\"crfType\", \"maxent\");","handlingStrategy":"validation","validationCode":"if (!flags.doGibbs && !\"maxent\".equalsIgnoreCase(flags.crfType))\n  throw new IllegalStateException(\"Unsupported crfType: \" + flags.crfType);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set crfType to \"maxent\" unless documentation explicitly lists another supported value.","Validate properties files before loading them into SeqClassifierFlags.","Don't copy crfType values from models trained under other CoreNLP versions."],"tags":["java","crf","config","inference-type"],"backgroundTag":"unsupported-config-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"}