{"record":{"id":"cd84e7b0b37499bd","repo":"apache/pulsar","slug":"retrieve-schema-instance-from-schema-info-for-type","errorCode":null,"errorMessage":"Retrieve schema instance from schema info for type '${schemaInfo.getType}' is not supported yet","messagePattern":"Retrieve schema instance from schema info for type '(.+?)' is not supported yet","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AutoConsumeSchema.java","lineNumber":273,"sourceCode":"                return LocalDateSchema.of();\n            case LOCAL_TIME:\n                return LocalTimeSchema.of();\n            case LOCAL_DATE_TIME:\n                return LocalDateTimeSchema.of();\n            case JSON:\n            case AVRO:\n                return GenericSchemaImpl.of(schemaInfo, false);\n            case PROTOBUF_NATIVE:\n                return GenericProtobufNativeSchema.of(schemaInfo);\n            case KEY_VALUE:\n                KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo =\n                        KeyValueSchemaInfo.decodeKeyValueSchemaInfo(schemaInfo);\n                Schema<?> keySchema = getSchema(kvSchemaInfo.getKey());\n                Schema<?> valueSchema = getSchema(kvSchemaInfo.getValue());\n                return KeyValueSchemaImpl.of(keySchema, valueSchema,\n                        KeyValueSchemaInfo.decodeKeyValueEncodingType(schemaInfo));\n            default:\n                throw new IllegalArgumentException(\"Retrieve schema instance from schema info for type '\"\n                        + schemaInfo.getType() + \"' is not supported yet\");\n        }\n    }\n\n    public Schema<GenericRecord> clone() {\n        AutoConsumeSchema schema = new AutoConsumeSchema();\n        schema.configureSchemaInfo(topicName, componentName, null);\n        if (schemaInfoProvider != null) {\n            schema.setSchemaInfoProvider(schemaInfoProvider);\n        }\n        for (Map.Entry<SchemaVersion, Schema<?>> entry : schemaMap.entrySet()) {\n            schema.setSchema(entry.getKey(), entry.getValue());\n        }\n        return schema;\n    }\n\n    @Override\n    public boolean requireFetchingSchemaInfo() {","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AutoConsumeSchema.java#L255-L291","documentation":"AutoConsumeSchema.generateSchema/getSchema converts a broker-provided SchemaInfo back into a Schema instance. When the SchemaInfo's type has no implemented reverse mapping (any type outside the supported NATIVE_AVRO/PROTOS/JSON/KEY_VALUE etc. cases), it throws IllegalArgumentException stating the type is not supported yet.","triggerScenarios":"A topic's schema is registered with a SchemaType that AutoConsumeSchema cannot instantiate (e.g. primitive types not covered by the switch, or exotic/custom types), and a consumer with Schema.AUTO_CONSUME() fetches that schema info.","commonSituations":"Topics whose schema was registered with unusual or legacy SchemaTypes; brokers upgraded with newer schema types while the client library is older and lacks the mapping; KeyValue schemas with unsupported inner types.","solutions":["Upgrade the Pulsar client to a version that supports the schema type in AutoConsumeSchema.getSchema","Re-register the topic schema with a supported type (AVRO/JSON/Protobuf/KeyValue)","Consume with a plain byte schema (Schema.BYTES) and deserialize manually if the type cannot be supported"],"exampleFix":"// before\nConsumer<GenericRecord> c = client.newConsumer().schema(Schema.AUTO_CONSUME())... // topic type unsupported\n// after\nConsumer<byte[]> c = client.newConsumer().schema(Schema.BYTES)...;\n// deserialize manually, or upgrade client","handlingStrategy":"try-catch","validationCode":"SchemaType type = schemaInfo.getType();\nSet<SchemaType> supported = Set.of(SchemaType.AVRO, SchemaType.JSON, SchemaType.PROTOBUF,\n    SchemaType.PROTOBUF_NATIVE, SchemaType.KEY_VALUE);\nif (!supported.contains(type)) {\n    // do not attempt AUTO_CONSUME for this topic\n}","typeGuard":"boolean isAutoConsumeSupportedType(SchemaInfo info) {\n    return info != null && EnumSet.of(SchemaType.AVRO, SchemaType.JSON,\n        SchemaType.PROTOBUF_NATIVE, SchemaType.KEY_VALUE).contains(info.getType());\n}","tryCatchPattern":"try {\n    Schema<GenericRecord> s = Schema.AUTO_CONSUME();\n} catch (IllegalArgumentException e) {\n    // fall back to Schema.BYTES and manual decoding\n}","preventionTips":["Keep client library version in sync with broker schema features","Check the topic's SchemaType with pulsar-admin schemas get before using AUTO_CONSUME","Register topic schemas only with widely supported types"],"tags":["pulsar","schema","auto-consume","unsupported-type","illegal-argument"],"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"}