{"record":{"id":"b97e230bb8810f10","repo":"apache/pulsar","slug":"unknown-schema-type","errorCode":null,"errorMessage":"Unknown schema type : ","messagePattern":"Unknown schema type : ","errorType":"validation","errorClass":"InvalidSchemaDataException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/validator/SchemaDataValidator.java","lineNumber":100,"sourceCode":"                break;\n            case NONE:\n            case BYTES:\n            case EXTERNAL:\n                // `NONE`, `BYTES` and `EXTERNAL` schema is not stored\n                break;\n            case AUTO:\n            case AUTO_CONSUME:\n            case AUTO_PUBLISH:\n                throw new InvalidSchemaDataException(\n                    \"Schema \" + schemaData.getType() + \" is a client-side schema type\");\n            case KEY_VALUE:\n                KeyValue<SchemaData, SchemaData> kvSchema =\n                    KeyValueSchemaCompatibilityCheck.decodeKeyValueSchemaData(schemaData);\n                validateSchemaData(kvSchema.getKey(), allowLegacyJacksonFormat);\n                validateSchemaData(kvSchema.getValue(), allowLegacyJacksonFormat);\n                break;\n            default:\n                throw new InvalidSchemaDataException(\"Unknown schema type : \" + schemaData.getType());\n        }\n    }\n\n    /**\n     * Validate a schema data is in a valid form.\n     *\n     * @param schemaData schema data to validate\n     * @throws InvalidSchemaDataException if the schema data is not in a valid form.\n     */\n    void validate(SchemaData schemaData) throws InvalidSchemaDataException;\n\n}\n","sourceCodeStart":82,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/validator/SchemaDataValidator.java#L82-L113","documentation":"The default branch of SchemaDataValidator.validateSchemaData throws InvalidSchemaDataException for any SchemaType the broker's validator switch does not recognize. It means the submitted schema type is not a storable/known server-side type in this broker version.","triggerScenarios":"Submitting a SchemaInfo with an unrecognized or newer SchemaType value — e.g. a custom/undefined type ordinal from an older or newer client, a type enum that fails the switch (primitives, STRING, AVRO, JSON, PROTOBUF_NATIVE, KEY_VALUE etc. are handled), or corrupt type metadata in a hand-built SchemaInfo.","commonSituations":"Client broker version skew: a client built against a newer SchemaType enum sends a type the broker doesn't know; manual REST payloads with a bad integer type code; generated SchemaInfo from third-party tooling with the type field left unset or mis-set.","solutions":["Use a broker-supported SchemaType (AVRO, JSON, STRING, INT32, KEY_VALUE, PROTOBUF_NATIVE, NONE, ...); check org.apache.pulsar.common.schema.SchemaType for the list.","Upgrade the broker to at least the client's version if the type was introduced later (e.g. newer protobuf/avro-derived types).","Inspect the submitted SchemaInfo: ensure the type field is set explicitly and not defaulted to an unknown ordinal.","For custom formats, store them under an existing generic type (BYTES/EXTERNAL) rather than inventing a type."],"exampleFix":"// before\nSchemaInfo info = SchemaInfoImpl.builder().type(SchemaType.of(999))\n    .data(data).build();\n// after\nSchemaInfo info = SchemaInfoImpl.builder().type(SchemaType.AVRO)\n    .data(data).schemaProperties(props).build();","handlingStrategy":"validation","validationCode":"import org.apache.pulsar.common.schema.SchemaType;\nimport java.util.EnumSet;\nprivate static final Set<SchemaType> STORABLE = EnumSet.of(\n    SchemaType.NONE, SchemaType.STRING, SchemaType.AVRO, SchemaType.JSON,\n    SchemaType.PROTOBUF_NATIVE, SchemaType.KEY_VALUE, SchemaType.INT8, SchemaType.INT16,\n    SchemaType.INT32, SchemaType.INT64, SchemaType.FLOAT, SchemaType.DOUBLE,\n    SchemaType.BOOLEAN, SchemaType.DATE, SchemaType.TIME, SchemaType.TIMESTAMP);\nif (!STORABLE.contains(info.getType())) {\n    throw new IllegalArgumentException(\"Unsupported schema type for registry: \" + info.getType());\n}","typeGuard":"boolean knownStorableType(SchemaInfo info) {\n    try { return info.getType() != null && info.getType() != SchemaType.NONE || true; }\n    catch (IllegalArgumentException e) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Keep client and broker versions aligned; check the broker's SchemaType enum before using newly added types.","Always set SchemaInfo.type explicitly when building it manually or via REST.","For custom formats, use a generic supported type (BYTES) plus schema properties."],"tags":["pulsar","schema-validation","version-compatibility"],"backgroundTag":"schema-validation-failed","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"}