{"record":{"id":"19ba2011b2664966","repo":"apache/pulsar","slug":"currently-type-name-is-not-supported","errorCode":null,"errorMessage":"Currently + type.name() +  is not supported","messagePattern":"Currently \\+ type\\.name\\(\\) \\+  is not supported","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaUtils.java","lineNumber":156,"sourceCode":"\n        if (!foundMatch) {\n            throw new RuntimeException(\"Invalid Java object for schema type \" + type\n                    + \" : \" + val.getClass()\n                    + \" for field : \\\"\" + name + \"\\\"\");\n        }\n\n        switch (type) {\n            case INT8:\n            case INT16:\n            case PROTOBUF:\n            case AVRO:\n            case AUTO_CONSUME:\n            case AUTO_PUBLISH:\n            case AUTO:\n            case KEY_VALUE:\n            case JSON:\n            case NONE:\n                throw new RuntimeException(\"Currently \" + type.name() + \" is not supported\");\n            default:\n                break;\n        }\n    }\n\n    public static Object toAvroObject(Object value) {\n        if (value != null) {\n            if (value instanceof ByteBuffer) {\n                ByteBuffer bb = (ByteBuffer) value;\n                byte[] bytes = new byte[bb.remaining()];\n                bb.duplicate().get(bytes);\n                return bytes;\n            } else if (value instanceof ByteBuf) {\n                return ByteBufUtil.getBytes((ByteBuf) value);\n            } else {\n                return value;\n            }\n        } else {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-common/src/main/java/org/apache/pulsar/client/impl/schema/SchemaUtils.java#L138-L174","documentation":"validateFieldSchema ends with an explicit rejection of schema types that cannot be used to validate plain Java objects: AUTO_CONSUME, AUTO_PUBLISH, AUTO, KEY_VALUE, JSON, and NONE. These are client-side special/aggregate types with no single-Java-object mapping, so encountering one in field validation throws RuntimeException 'Currently <TYPE> is not supported'.","triggerScenarios":"Invoking field-level schema validation while the field's declared SchemaType is one of AUTO_CONSUME, AUTO_PUBLISH, AUTO, KEY_VALUE, JSON, or NONE — typically when programmatically deriving Avro schemas from POJO fields annotated/inferred with those types.","commonSituations":"Annotating a POJO field with @AvroSchemaType-like inference that resolves to AUTO/KEY_VALUE/JSON; passing SchemaType.NONE due to an unset/missing schema annotation; auto-schema pipelines calling validateFieldSchema on generic container fields.","solutions":["Declare a concrete, primitive-compatible SchemaType for the field instead of AUTO*/KEY_VALUE/JSON/NONE.","If the field is genuinely KEY_VALUE or JSON, define it as a nested structured schema (its own record) so each subfield validates independently.","Ensure schema annotations are properly set — SchemaType.NONE usually means the type was never resolved; fix the annotation/registration.","Skip validateFieldSchema for such fields and handle them via dedicated JSON/KeyValue schema serializers."],"exampleFix":"// before\n@SchemaType(SchemaType.AUTO_CONSUME) private Object payload;\n// after\n@SchemaType(SchemaType.STRING) private String payload; // or a nested record type with its own schema","handlingStrategy":"validation","validationCode":"Set<SchemaType> unsupported = Set.of(SchemaType.AUTO_CONSUME, SchemaType.AUTO_PUBLISH, SchemaType.AUTO,\n    SchemaType.KEY_VALUE, SchemaType.JSON, SchemaType.NONE);\nif (unsupported.contains(type)) {\n    throw new IllegalArgumentException(\"field '\" + name + \"' uses non-validatable schema type \" + type);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare concrete SchemaTypes on every POJO field so NONE never appears.","Model KEY_VALUE/JSON data as nested records with their own schemas.","Skip validateFieldSchema for container/special types and use their dedicated serializers."],"tags":["schema","validation","unsupported-feature","avro"],"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-14T05:17:10.506Z"}