{"record":{"id":"a79633d99d0f1fe6","repo":"stanfordnlp/CoreNLP","slug":"unknown-model-type-modeltype","errorCode":null,"errorMessage":"Unknown model type \" + modelType","messagePattern":"Unknown model type \" \\+ modelType","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/neural/ConvertModels.java","lineNumber":467,"sourceCode":"        ObjectInputStream in = IOUtils.readStreamFromString(inputPath);\n        NeuralCorefModel model = readCoref(in);\n        in.close();\n        IOUtils.writeObjectToFile(model, outputPath);\n      }\n    } else if (modelType == Model.FASTCOREF) {\n      if (stage == Stage.OLD) {\n        FastNeuralCorefModel model = ErasureUtils.uncheckedCast(IOUtils.readObjectFromURLOrClasspathOrFileSystem(inputPath));\n        ObjectOutputStream out = IOUtils.writeStreamFromString(outputPath);\n        writeFastCoref(model, out);\n        out.close();\n      } else {\n        ObjectInputStream in = IOUtils.readStreamFromString(inputPath);\n        FastNeuralCorefModel model = readFastCoref(in);\n        in.close();\n        IOUtils.writeObjectToFile(model, outputPath);\n      }\n    } else {\n      throw new IllegalArgumentException(\"Unknown model type \" + modelType);\n    }\n  }\n}\n\n","sourceCodeStart":449,"sourceCodeEnd":472,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/neural/ConvertModels.java#L449-L472","documentation":"After validating the -model property, ConvertModels.main dispatches on the Model enum; if the parsed modelType falls through all known branches it throws IllegalArgumentException('Unknown model type ' + modelType). This guards against enum values added to Model but not yet handled in main's switch/if chain.","triggerScenarios":"Model enum contains a value with no conversion branch in main (e.g. a newly added model type), reaching the final else of main.","commonSituations":"Running a newer model enum value against an older ConvertModels version, or custom builds where Model was extended without updating main's dispatch.","solutions":["Use a model type supported by this ConvertModels build (SENTIMENT, DVPARSER, EMBEDDING, COREF, FASTCOREF)","Add a conversion branch for the new Model value in main","Rebuild/upgrade to a CoreNLP version whose ConvertModels handles the model type"],"exampleFix":"// before\njava ... -model NEWTYPE -input m.gz -output m2.gz\n// after\njava ... -model COREF -input m.gz -output m2.gz  // use a handled type, or patch main() to support NEWTYPE","handlingStrategy":"validation","validationCode":"java.util.Set<String> handled = java.util.Set.of(\"SENTIMENT\",\"DVPARSER\",\"EMBEDDING\",\"COREF\",\"FASTCOREF\");\nif (!handled.contains(modelType)) {\n  throw new IllegalArgumentException(\"model type \" + modelType + \" has no conversion branch\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  ConvertModels.main(args);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unknown model type\")) {\n    System.err.println(\"Model not supported by this ConvertModels build: \" + e.getMessage());\n    System.exit(3);\n  }\n  throw e;\n}","preventionTips":["Only pass model types supported by the deployed CoreNLP version","Keep Model enum and main's dispatch in sync when extending the converter","Pin a known-good CoreNLP version in conversion pipelines"],"tags":["enum","dispatch","model-conversion","unsupported"],"backgroundTag":"unsupported-enum-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"}