apache/dubbo · error · RuntimeException

Unknown primitive type: {}

Error message

Unknown primitive type: {}

What it means

Thrown by the private arg() helper when a Class is reported as primitive (cl.isPrimitive() true) but does not match any of the eight known primitive types (boolean, byte, char, double, float, int, long, short). On a standard JVM this branch is effectively unreachable; it is a defensive guard against a malformed or non-standard primitive Class object.

Source

Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java:395

            if (cl == Character.TYPE) {
                return "((Character)" + name + ").charValue()";
            }
            if (cl == Double.TYPE) {
                return "((Number)" + name + ").doubleValue()";
            }
            if (cl == Float.TYPE) {
                return "((Number)" + name + ").floatValue()";
            }
            if (cl == Integer.TYPE) {
                return "((Number)" + name + ").intValue()";
            }
            if (cl == Long.TYPE) {
                return "((Number)" + name + ").longValue()";
            }
            if (cl == Short.TYPE) {
                return "((Number)" + name + ").shortValue()";
            }
            throw new RuntimeException("Unknown primitive type: " + cl.getName());
        }
        return "(" + ReflectUtils.getName(cl) + ")" + name;
    }

    private static String args(Class<?>[] cs, String name) {
        int len = cs.length;
        if (len == 0) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < len; i++) {
            if (i > 0) {
                sb.append(',');
            }
            sb.append(arg(cs[i], name + "[" + i + "]"));
        }
        return sb.toString();
    }

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Verify you are running on a standard, unmodified JVM without instrumentation agents that tamper with primitive Class objects.
  2. Ensure no bytecode library (ASM/javassist) has synthesized an invalid primitive Class.
  3. Report as a Dubbo issue if it reproduces on a stock JVM, including the full class name printed in the message.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Wrapper w = Wrapper.getWrapper(c);
} catch (RuntimeException e) {
    // unknown primitive type; report JVM/toolchain anomaly
}

Prevention

When it happens

Trigger: A Class object for which isPrimitive() returns true yet is not one of the eight standard TYPE constants. This would require a custom/agent-modified Class or a JVM bug; it should not occur in normal operation.

Common situations: Practically never hit in production. If encountered, suspect bytecode manipulation tooling, a JVM instrumentation agent, or a corrupted class definition that produced a non-standard primitive Class.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/680418c354b49097. Report an issue: GitHub.