{"record":{"id":"a18c91687aec99c3","repo":"pinpoint-apm/pinpoint","slug":"unsupported-datatype-typecode-data-o","errorCode":null,"errorMessage":"unsupported DataType:${typeCode} data:${o}","messagePattern":"unsupported DataType:(.+?) data:(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/AnnotationTranscoder.java","lineNumber":535,"sourceCode":"            case CODE_NULL:\n                return null;\n            case CODE_TOSTRING:\n                final String str = o.toString();\n                return encodeString(str);\n            case CODE_INT_STRING:\n                return encodeIntStringValue(o);\n            case CODE_INT_STRING_STRING:\n                return encodeIntStringStringValue(o);\n            case CODE_STRING_STRING:\n                return encodeStringStringValue(o);\n            case CODE_LONG_INT_INT_BYTE_BYTE_STRING:\n                return encodeLongIntIntByteByteStringValue(o);\n            case CODE_INT_BOOLEAN_INT_BOOLEAN:\n                return encodeIntBooleanIntBooleanValue(o);\n            case CODE_BYTES_STRING_STRING:\n                return encodeBytesStringStringValue(o);\n        }\n        throw new IllegalArgumentException(\"unsupported DataType:\" + typeCode + \" data:\" + o);\n    }\n\n\n    private DataType decodeIntStringValue(byte[] data) {\n        final Buffer buffer = new FixedBuffer(data);\n        final int intValue = buffer.readSVInt();\n        final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());\n        return new IntStringValue(intValue, stringValue);\n    }\n\n\n    private static byte[] encodeIntStringValue(Object value) {\n        final IntStringValue tIntStringValue = (IntStringValue) value;\n        final int intValue = tIntStringValue.getIntValue();\n        final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());\n        // TODO increase by a more precise value\n        final int bufferSize = getBufferSize(stringValue, 4 + 8);\n        final Buffer buffer = new AutomaticBuffer(bufferSize);","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/AnnotationTranscoder.java#L517-L553","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Register the new value type with a proper DataType type code and encoder in AnnotationTranscoder","Convert the value into a supported type (e.g. String, IntStringStringValue) before encoding","Check getEncoder(Object) resolution: ensure the object's class maps to an existing type code","Avoid the deprecated encode(Object) path; use getEncoder(Object) which does a single type dispatch"],"exampleFix":"// before\nbyte[] bytes = transcoder.encode(myCustomValue); // unknown type code\n// after\nDataTypeAnnotationBo bo = new DataTypeAnnotationBo(key, new StringStringValue(myCustomValue.toString()));\nbyte[] bytes = transcoder.getEncoder(bo.getValue()).encode(bo.getValue());","handlingStrategy":"type-guard","validationCode":"DataType type = DataType.resolveTypeForClass(o.getClass()); if (type == null || !isEncodable(type)) { throw new SkipAnnotationException(o.getClass()); }","typeGuard":"boolean isEncodable(Object o) { return o instanceof String || o instanceof Integer || o instanceof Long || o instanceof IntStringStringValue || o instanceof StringStringValue; }","tryCatchPattern":"try { return transcoder.encode(value); } catch (IllegalArgumentException e) { log.warn(\"cannot encode {}: {}\", value.getClass(), e.getMessage()); return null; }","preventionTips":["Only use registered annotation value types in agents","Use getEncoder(Object) instead of the deprecated encode(Object)","Add type-code registration when introducing new annotation value classes"],"tags":["java","serialization","annotations"],"backgroundTag":"unsupported-enum-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}