{"record":{"id":"8e44b9487e9e6e54","repo":"apache/dubbo","slug":"type-type-is-unsupported","errorCode":null,"errorMessage":"type [ ${type} ] is unsupported","messagePattern":"type \\[ (.+?) \\] is unsupported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanDescriptor.java","lineNumber":67,"sourceCode":"    private static final int TYPE_MAX = TYPE_BEAN;\n    /**\n     * Used to define a type is valid.\n     *\n     * @see #isValidType(int)\n     */\n    private static final int TYPE_MIN = TYPE_CLASS;\n\n    private String className;\n    private int type;\n\n    private final Map<Object, Object> properties = new LinkedHashMap<>();\n\n    public JavaBeanDescriptor() {}\n\n    public JavaBeanDescriptor(String className, int type) {\n        notEmpty(className, \"class name is empty\");\n        if (!isValidType(type)) {\n            throw new IllegalArgumentException(\"type [ \" + type + \" ] is unsupported\");\n        }\n\n        this.className = className;\n        this.type = type;\n    }\n\n    public boolean isClassType() {\n        return TYPE_CLASS == type;\n    }\n\n    public boolean isEnumType() {\n        return TYPE_ENUM == type;\n    }\n\n    public boolean isCollectionType() {\n        return TYPE_COLLECTION == type;\n    }\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanDescriptor.java#L49-L85","documentation":"Thrown by the JavaBeanDescriptor(String, int) constructor when the supplied type int is outside the valid range [TYPE_CLASS=1 .. TYPE_BEAN=7]. JavaBeanDescriptor uses an int discriminator (CLASS, ENUM, COLLECTION, MAP, ARRAY, PRIMITIVE, BEAN); an out-of-range value would leave the descriptor in an inconsistent state, so it is rejected at construction. IllegalArgumentException.","triggerScenarios":"new JavaBeanDescriptor(className, type) with type < 1 or type > 7, e.g. passing 0, 8, or a raw value read from an untrusted/legacy serialized stream. Also when computing the type via arithmetic or constants that yields an invalid ordinal.","commonSituations":"Deserializing a JavaBeanDescriptor from a corrupted or version-mismatched byte stream; hand-building a descriptor with a wrong constant; migration where a type constant was removed/renumbered; passing a default int (0) because the type field was never set.","solutions":["Use the documented TYPE_* constants (JavaBeanDescriptor.TYPE_CLASS, TYPE_ENUM, ...) instead of literal numbers.","If the value comes from deserialization, validate/upgrade it against the constant range before constructing.","Initialize type from a known constant rather than leaving it at the default 0.","When reading from legacy data, map old ordinals to current TYPE_* values explicitly."],"exampleFix":"// before\ndesc = new JavaBeanDescriptor(className, 0);   // 0 is not a valid type\n// after\ndesc = new JavaBeanDescriptor(className, JavaBeanDescriptor.TYPE_CLASS);","handlingStrategy":"validation","validationCode":"// Validate the type ordinal before constructing a JavaBeanDescriptor\nboolean isValidType(int type) {\n    return type >= JavaBeanDescriptor.TYPE_CLASS && type <= JavaBeanDescriptor.TYPE_BEAN;\n}\n// if (isValidType(t)) new JavaBeanDescriptor(className, t); else throw/reject;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the TYPE_* constants instead of literal ints.","Validate type ordinals read from external/serialized data before constructing.","Initialize the type field explicitly rather than relying on the default 0.","When migrating versions, remap old ordinals to the current TYPE_* constants."],"tags":["beanutil","validation","serialization","dubbo-common"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}