{"record":{"id":"230312f99b3a52c4","repo":"apache/pulsar","slug":"unsupported-schema-type-s","errorCode":null,"errorMessage":"Unsupported schema type%s","messagePattern":"Unsupported schema type(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java","lineNumber":1204,"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 SchemaType getSchemaTypeOrDefault(Record<?> record, Class<?> clazz) {\n        if (GenericObject.class.isAssignableFrom(clazz)) {\n            return SchemaType.AUTO_CONSUME;\n        } else if (byte[].class.equals(clazz)\n            || ByteBuf.class.equals(clazz)\n            || ByteBuffer.class.equals(clazz)) {\n            // if sink uses bytes, we should ignore\n            return SchemaType.NONE;\n        } else {\n            Schema<?> schema = record.getSchema();\n            if (schema != null) {\n                if (schema.getSchemaInfo().getType() == SchemaType.NONE) {\n                    return getDefaultSchemaType(clazz);\n                } else {\n                    return schema.getSchemaInfo().getType();","sourceCodeStart":1186,"sourceCodeEnd":1222,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java#L1186-L1222","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (function submit)\n--output-schema-type KEY_VALUE\n// after\n--output-schema-type JSON   # or AVRO / STRING / AUTO_PUBLISH as supported","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"STRING\",\"JSON\",\"AVRO\",\"PROTOBUF\",\"PROTOBUF_NATIVE\",\"AUTO_CONSUME\",\"AUTO_PUBLISH\",\"BOOLEAN\",\"INT8\",\"INT16\",\"INT32\",\"INT64\",\"FLOAT32\",\"FLOAT64\",\"KEY_VALUE\");\nif (!supported.contains(details.getOutputSchemaType())) {\n    throw new IllegalArgumentException(\"Unsupported schema type: \" + details.getOutputSchemaType());\n}","typeGuard":null,"tryCatchPattern":"try { deployFunction(); }\ncatch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unsupported schema type\")) {\n    log.error(\"Switch to a supported schema type or upgrade function workers\", e);\n  }\n}","preventionTips":["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"],"tags":["java","pulsar-functions","schema","unsupported-type"],"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-14T00:17:10.932Z"}