pinpoint-apm/pinpoint · error · IllegalArgumentException

unsupported DataType:${typeCode} data:${o}

Error message

unsupported DataType:${typeCode} data:${o}

What it means

AnnotationTranscoder.encode() dispatches on the resolved integer type code to pick an encoding routine; if the code has no case it throws IllegalArgumentException including the offending object. It means an annotation value object could not be mapped to a supported wire type for serialization.

Source

Thrown at commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/AnnotationTranscoder.java:535

            case CODE_NULL:
                return null;
            case CODE_TOSTRING:
                final String str = o.toString();
                return encodeString(str);
            case CODE_INT_STRING:
                return encodeIntStringValue(o);
            case CODE_INT_STRING_STRING:
                return encodeIntStringStringValue(o);
            case CODE_STRING_STRING:
                return encodeStringStringValue(o);
            case CODE_LONG_INT_INT_BYTE_BYTE_STRING:
                return encodeLongIntIntByteByteStringValue(o);
            case CODE_INT_BOOLEAN_INT_BOOLEAN:
                return encodeIntBooleanIntBooleanValue(o);
            case CODE_BYTES_STRING_STRING:
                return encodeBytesStringStringValue(o);
        }
        throw new IllegalArgumentException("unsupported DataType:" + typeCode + " data:" + o);
    }


    private DataType decodeIntStringValue(byte[] data) {
        final Buffer buffer = new FixedBuffer(data);
        final int intValue = buffer.readSVInt();
        final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
        return new IntStringValue(intValue, stringValue);
    }


    private static byte[] encodeIntStringValue(Object value) {
        final IntStringValue tIntStringValue = (IntStringValue) value;
        final int intValue = tIntStringValue.getIntValue();
        final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());
        // TODO increase by a more precise value
        final int bufferSize = getBufferSize(stringValue, 4 + 8);
        final Buffer buffer = new AutomaticBuffer(bufferSize);

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Register the new value type with a proper DataType type code and encoder in AnnotationTranscoder
  2. Convert the value into a supported type (e.g. String, IntStringStringValue) before encoding
  3. Check getEncoder(Object) resolution: ensure the object's class maps to an existing type code
  4. Avoid the deprecated encode(Object) path; use getEncoder(Object) which does a single type dispatch

Example fix

// before
byte[] bytes = transcoder.encode(myCustomValue); // unknown type code
// after
DataTypeAnnotationBo bo = new DataTypeAnnotationBo(key, new StringStringValue(myCustomValue.toString()));
byte[] bytes = transcoder.getEncoder(bo.getValue()).encode(bo.getValue());
Defensive patterns

Strategy: type-guard

Validate before calling

DataType type = DataType.resolveTypeForClass(o.getClass()); if (type == null || !isEncodable(type)) { throw new SkipAnnotationException(o.getClass()); }

Type guard

boolean isEncodable(Object o) { return o instanceof String || o instanceof Integer || o instanceof Long || o instanceof IntStringStringValue || o instanceof StringStringValue; }

Try / catch

try { return transcoder.encode(value); } catch (IllegalArgumentException e) { log.warn("cannot encode {}: {}", value.getClass(), e.getMessage()); return null; }

Prevention

When it happens

Trigger: Calling encode(Object o) (or getEncoder(...).encode) with an annotation value whose resolved type code is unsupported — e.g. a custom/novel value class or null handed to the deprecated encode path.

Common situations: Introducing a new annotation value type in an agent without registering a type code and encoder in commons-server; passing wrong object types in tests or migration code.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/a18c91687aec99c3. Report an issue: GitHub.