{"record":{"id":"157948030036b404","repo":"apache/pulsar","slug":"schema-schematype-is-a-client-side-schema-type","errorCode":null,"errorMessage":"Schema ${schemaType} is a client-side schema type","messagePattern":"Schema (.+?) is a client-side 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":91,"sourceCode":"            case DOUBLE:\n            case DATE:\n            case TIME:\n            case TIMESTAMP:\n            case INSTANT:\n            case LOCAL_DATE:\n            case LOCAL_TIME:\n            case LOCAL_DATE_TIME:\n                PrimitiveSchemaDataValidator.of().validate(schemaData);\n                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     */","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/validator/SchemaDataValidator.java#L73-L109","documentation":"SchemaDataValidator.validateSchemaData rejects schema types that only make sense on the client side: AUTO, AUTO_CONSUME and AUTO_PUBLISH. These are placeholder/auto-resolving types, so a schema claiming one of them cannot be stored in the registry — the real concrete type must be resolved before registration. (NONE/BYTES/EXTERNAL are skipped, KEY_VALUE recurses into key and value schemas.)","triggerScenarios":"Uploading/uploading via REST or the client a SchemaInfo whose type is SchemaType.AUTO, AUTO_CONSUME or AUTO_PUBLISH — e.g. calling admin.schemas().createSchema(topic, schemaInfo) with Schema.AUTO_PRODUCE_BYTES() or Schema.AUTO_CONSUME() info without resolving the underlying concrete schema first.","commonSituations":"Automation copying the producer's auto schema info straight into the registry; frameworks that pass through client schema objects to admin APIs; code paths where auto schema resolution was skipped because no message had been seen yet.","solutions":["Resolve the concrete schema before registering: use Schema.AUTO_PRODUCE_BYTES(...).getSchemaInfo() only after decoding, or capture the real schema from a message's schema version.","Register the actual type explicitly (AVRO/JSON/PROTOBUF_NATIVE/STRING/...) instead of the AUTO type.","If the topic should be schemaless, do not register a schema at all (or use NONE) rather than an AUTO type.","For KEY_VALUE producers, register the concrete KV schema whose key/value parts are non-AUTO."],"exampleFix":"// before\nSchemaInfo info = Schema.AUTO_CONSUME().getSchemaInfo();\nadmin.schemas().createSchema(topic, info);\n// after\nSchemaInfo info = Schema.JSON(User.class).getSchemaInfo();\nadmin.schemas().createSchema(topic, info);","handlingStrategy":"validation","validationCode":"import org.apache.pulsar.common.schema.SchemaType;\nif (info.getType() == SchemaType.AUTO\n        || info.getType() == SchemaType.AUTO_CONSUME\n        || info.getType() == SchemaType.AUTO_PUBLISH) {\n    throw new IllegalArgumentException(\"Resolve AUTO schema to a concrete type before registering: \" + info.getType());\n}","typeGuard":"boolean isStorableType(SchemaType t) {\n    return t != SchemaType.AUTO && t != SchemaType.AUTO_CONSUME && t != SchemaType.AUTO_PUBLISH;\n}","tryCatchPattern":null,"preventionTips":["Never upload the SchemaInfo of Schema.AUTO_CONSUME()/AUTO_PRODUCE_BYTES(); resolve the concrete schema from the message first.","In admin tooling, whitelist storable schema types before calling createSchema.","For schemaless topics, skip registration (or use NONE) instead of an AUTO type."],"tags":["pulsar","schema-validation"],"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"}