apache/dubbo · error · IllegalArgumentException
Unsupported type ${className}:${type}
Error message
Unsupported type ${className}:${type} What it means
Thrown by deserializeInternal when a JavaBeanDescriptor's type field matches none of the recognized categories (enum, class, primitive, array, collection, map, bean). The message prints className:type so the invalid type integer is visible. It indicates a corrupt or hand-crafted descriptor whose type is outside TYPE_CLASS..TYPE_BEAN.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java:303
setByMethod = true;
}
} catch (Exception e) {
LogHelper.warn(logger, "Failed to set property through method " + method, e);
}
if (!setByMethod) {
try {
Field field = result.getClass().getField(property);
if (field != null) {
field.set(result, value);
}
} catch (NoSuchFieldException | IllegalAccessException e1) {
LogHelper.warn(logger, "Failed to set field value", e1);
}
}
}
} else {
throw new IllegalArgumentException(
"Unsupported type " + beanDescriptor.getClassName() + ":" + beanDescriptor.getType());
}
}
private static Method getSetterMethod(Class<?> cls, String property, Class<?> valueCls) {
String name = "set" + property.substring(0, 1).toUpperCase() + property.substring(1);
Method method = null;
try {
method = cls.getMethod(name, valueCls);
} catch (NoSuchMethodException e) {
for (Method m : cls.getMethods()) {
if (ReflectUtils.isBeanPropertyWriteMethod(m) && m.getName().equals(name)) {
method = m;
}
}
}
if (method != null) {
method.setAccessible(true);View on GitHub (pinned to 3a3043227f)
Solutions
- Validate descriptor.getType() is in [1..7] (TYPE_CLASS..TYPE_BEAN) before calling deserialize.
- Ensure producer and consumer run the same Dubbo version so descriptor type constants agree.
- If the descriptor was hand-built, construct it with new JavaBeanDescriptor(name, TYPE_*) which already validates the type.
Example fix
// before
Object o = JavaBeanSerializeUtil.deserialize(descriptor);
// after
int t = descriptor.getType();
if (t < JavaBeanDescriptor.TYPE_CLASS || t > JavaBeanDescriptor.TYPE_BEAN) {
throw new IllegalArgumentException("refusing descriptor with invalid type " + t);
}
Object o = JavaBeanSerializeUtil.deserialize(descriptor); Defensive patterns
Strategy: validation
Validate before calling
int t = descriptor.getType();
if (t < JavaBeanDescriptor.TYPE_CLASS || t > JavaBeanDescriptor.TYPE_BEAN) {
throw new IllegalArgumentException("invalid descriptor type: " + t);
}
JavaBeanSerializeUtil.deserialize(descriptor); Prevention
- Always build descriptors via new JavaBeanDescriptor(name, TYPE_*) so the type is validated at construction.
- Do not call setType() with arbitrary integers.
- Keep producer and consumer Dubbo versions aligned.
When it happens
Trigger: JavaBeanSerializeUtil.deserialize(descriptor) where descriptor.getType() is 0, negative, or > 7; a descriptor deserialized from tampered/corrupted transport bytes whose type byte was altered.
Common situations: A peer running a different/older Dubbo version that writes a type value the receiver does not know; manual construction with setType() to an invalid constant; byte-level corruption of the descriptor on the wire.
Related errors
- type [ ${type} ] is unsupported
- ${message}
- ${cause.message}
- Invalid configurator rule, please specify at least one param
- service field in configuration is null.
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/9c3ddb71453e1edb.
Report an issue: GitHub.