{"record":{"id":"a094f130efa59051","repo":"apache/pulsar","slug":"unsupported-schema-type-type","errorCode":null,"errorMessage":"Unsupported schema type${type}","messagePattern":"Unsupported schema type(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/TopicSchema.java","lineNumber":190,"sourceCode":"                    .withPojo(clazz).build());\n\n        case JSON:\n            return JSONSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());\n\n        case KEY_VALUE:\n            return (Schema<T>) Schema.KV_BYTES();\n\n        case PROTOBUF:\n            return ProtobufSchema.ofGenericClass(clazz, new HashMap<>());\n\n        case PROTOBUF_NATIVE:\n            return ProtobufNativeSchema.ofGenericClass(clazz, new HashMap<>());\n\n        case AUTO_PUBLISH:\n            return (Schema<T>) Schema.AUTO_PRODUCE_BYTES();\n\n        default:\n            throw new RuntimeException(\"Unsupported schema type\" + type);\n        }\n    }\n\n    private static boolean isProtobufClass(Class<?> pojoClazz) {\n        try {\n            Class<?> protobufBaseClass = Class.forName(\"com.google.protobuf.Message\");\n            return protobufBaseClass.isAssignableFrom(pojoClazz);\n        } catch (ClassNotFoundException | NoClassDefFoundError e) {\n            // If function does not have protobuf in classpath then it cannot be protobuf\n            return false;\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> Schema<T> newSchemaInstance(String topic, Class<T> clazz, String schemaTypeOrClassName, boolean input,\n                                            ClassLoader classLoader) {\n        return newSchemaInstance(topic, clazz, new ConsumerConfig(schemaTypeOrClassName), input, classLoader);\n    }","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/TopicSchema.java#L172-L208","documentation":"TopicSchema.newSchemaInstance maps a SchemaType to a concrete Schema implementation for function input/output topics. Thrown when the configured schema type has no supported instantiation path in this switch (default branch), typically a schema type the function runtime doesn't know how to build.","triggerScenarios":"Function config declares a schema type (schemaType / serialization class resolution) that reaches the default case, e.g. KEY_VALUE, AVRO variants, or AUTO_CONSUME used where unsupported, instead of the handled types (STRING, JSON, AVRO, PROTOBUF, PROTOBUF_NATIVE, AUTO_PUBLISH, etc.).","commonSituations":"Misconfigured function YAML (wrong schemaType string); using a newer schema type with an older function instance; letting the runtime infer a type that maps to an unhandled enum constant.","solutions":["Set an explicitly supported schemaType in the function config (STRING, JSON, AVRO, PROTOBUF, AUTO_CONSUME/AUTO_PUBLISH as supported by your version).","Use the Java class name (serdeClassname) with a built-in type instead of an exotic schema type.","Upgrade the function instance runtime if the schema type is from a newer Pulsar release."],"exampleFix":"// before (functions.yml)\nschemaType: KEY_VALUE\n// after\nschemaType: JSON\n// or use class-based config\nclassName: com.google.protobuf.Message","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"STRING\",\"JSON\",\"AVRO\",\"PROTOBUF\",\"PROTOBUF_NATIVE\",\"AUTO_CONSUME\",\"AUTO_PUBLISH\");\nString t = fnConfig.getOutputSchemaType();\nif (!supported.contains(t)) {\n  throw new IllegalArgumentException(\"schemaType \" + t + \" not supported by this runtime\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  Schema<T> s = topicSchema.getSchema(topic, clazz, conf, type, ...);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unsupported schema type\")) {\n    // fall back to a supported type or upgrade the runtime\n  }\n}","preventionTips":["Pin schemaType to values supported by the deployed Pulsar version","Prefer explicit serde class names over inferred schema types","Test function configs against the target runtime version before release"],"tags":["schema","config","pulsar-functions"],"backgroundTag":"unsupported-schema-type","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}