apache/pulsar · error · RuntimeException
Unsupported schema type%s
Error message
Unsupported schema type%s
What it means
In createSchema (invoked from setup), the function's declared schema type (SchemaDetails type) hits the default branch of the switch, meaning the runtime has no Schema<T> factory for that schema type enum. Only known schema types (STRING, AVRO, JSON, PROTOBUF, PROTOBUF_NATIVE, AUTO_CONSUME, AUTO_PUBLISH, etc.) are supported.
Source
Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java:1204
.withPojo(clazz).build());
case JSON:
return JSONSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());
case KEY_VALUE:
return (Schema<T>) Schema.KV_BYTES();
case PROTOBUF:
return ProtobufSchema.ofGenericClass(clazz, new HashMap<>());
case PROTOBUF_NATIVE:
return ProtobufNativeSchema.ofGenericClass(clazz, new HashMap<>());
case AUTO_PUBLISH:
return (Schema<T>) Schema.AUTO_PRODUCE_BYTES();
default:
throw new RuntimeException("Unsupported schema type" + type);
}
}
private static SchemaType getSchemaTypeOrDefault(Record<?> record, Class<?> clazz) {
if (GenericObject.class.isAssignableFrom(clazz)) {
return SchemaType.AUTO_CONSUME;
} else if (byte[].class.equals(clazz)
|| ByteBuf.class.equals(clazz)
|| ByteBuffer.class.equals(clazz)) {
// if sink uses bytes, we should ignore
return SchemaType.NONE;
} else {
Schema<?> schema = record.getSchema();
if (schema != null) {
if (schema.getSchemaInfo().getType() == SchemaType.NONE) {
return getDefaultSchemaType(clazz);
} else {
return schema.getSchemaInfo().getType();View on GitHub (pinned to 820761864e)
Solutions
- Check the configured schemaType for the function's input/output and change it to a supported type (STRING, JSON, AVRO, PROTOBUF, PROTOBUF_NATIVE, AUTO_CONSUME, AUTO_PUBLISH)
- Align function worker and broker/client versions so the schema type enum values match; upgrade workers if the type was introduced in a newer Pulsar
- Use Schema.AUTO_PRODUCE_BYTES() (AUTO_PUBLISH) or AUTO_CONSUME semantics explicitly instead of a custom type string
- Redeploy the function after correcting the schema configuration
Example fix
// before (function submit) --output-schema-type KEY_VALUE // after --output-schema-type JSON # or AVRO / STRING / AUTO_PUBLISH as supported
Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of("STRING","JSON","AVRO","PROTOBUF","PROTOBUF_NATIVE","AUTO_CONSUME","AUTO_PUBLISH","BOOLEAN","INT8","INT16","INT32","INT64","FLOAT32","FLOAT64","KEY_VALUE");
if (!supported.contains(details.getOutputSchemaType())) {
throw new IllegalArgumentException("Unsupported schema type: " + details.getOutputSchemaType());
} Try / catch
try { deployFunction(); }
catch (RuntimeException e) {
if (e.getMessage().startsWith("Unsupported schema type")) {
log.error("Switch to a supported schema type or upgrade function workers", e);
}
} Prevention
- Only configure schema types supported by your function-worker version
- Keep brokers, clients, and function workers on compatible Pulsar versions
- Prefer AUTO_PUBLISH/AUTO_CONSUME for pass-through or generic components
- Validate the function config with pulsar-admin before deployment
When it happens
Trigger: FunctionDetails carries a schemaType value the instance runtime doesn't recognize — typically a newer/older Pulsar SchemaType enum crossing a version boundary, or a custom/legacy type (e.g. a key-value or auto type) configured for a component that maps to no case in this switch.
Common situations: Deploying a function submitted by a newer broker/client to older function workers (schema type added later); scripting function config with a raw schemaType string that mismatches the enum; using AUTO_PRODUCE/AUTO_CONSUME on an unsupported component position.
Related errors
- Schema should not be null.
- Schema type mismatch ${typeArg} vs ${schemaTypeArg}
- Failed to add schema to an active topic with empty(BYTES) sc
- Error during schema compatibility check with strategy ${stra
- Retrieve schema instance from schema info for type '${schema
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/230312f99b3a52c4.
Report an issue: GitHub.