pinpoint-apm/pinpoint · error · IllegalStateException

Unknown attribute type code: ${typeCode}

Error message

Unknown attribute type code: ${typeCode}

What it means

AttributeTranscoder.readValue() decodes a typed attribute value from a Buffer and, for a type code outside the known set, throws IllegalStateException('Unknown attribute type code'). Because this happens mid-buffer-parse, it signals either an unsupported/foreign type code or a desynchronized buffer position.

Source

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

                int arraySize = buffer.readVInt();
                List<AttributeValue> list = new ArrayList<>(arraySize);
                for (int i = 0; i < arraySize; i++) {
                    list.add(readValue(buffer));
                }
                return AttributeValue.of(list);
            }
            case TYPE_KVLIST: {
                int kvSize = buffer.readVInt();
                AttributeKeyValue[] kvArray = new AttributeKeyValue[kvSize];
                for (int i = 0; i < kvSize; i++) {
                    String key = buffer.readNullTerminatedString();
                    AttributeValue val = readValue(buffer);
                    kvArray[i] = AttributeKeyValue.of(key, val);
                }
                return AttributeValue.ofAttributeKeyValueList(kvArray);
            }
            default:
                throw new IllegalStateException("Unknown attribute type code: " + typeCode);
        }
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Upgrade the reader's AttributeTranscoder to a version that knows the type code
  2. Verify the buffer position is at the start of the attribute value before calling readValue
  3. Log the raw typeCode and surrounding bytes to identify the writer/version
  4. Fail gracefully per attribute instead of aborting the whole record read

Example fix

// before
AttributeValue v = transcoder.readValue(buffer); // IllegalStateException on unknown code
// after
int code = buffer.readByte();
if (!AttributeTranscoder.isKnownCode(code)) { log.warn("unknown attr code {}", code); return null; }
buffer.reset();
AttributeValue v = transcoder.readValue(buffer);
Defensive patterns

Strategy: try-catch

Validate before calling

int code = peekTypeCode(buffer); if (!AttributeTranscoder.isKnownCode(code)) { log.warn("unknown attr code {}", code); return null; }

Try / catch

try { return transcoder.readValue(buffer); } catch (IllegalStateException e) { log.warn("attribute read failed: {}", e.getMessage()); return null; }

Prevention

When it happens

Trigger: Calling readValue (directly or via value()/val()) on bytes whose leading type-code byte is not a registered attribute type — from version skew between writer and reader, or from reading at the wrong buffer offset.

Common situations: Mixed-version clusters where new nodes write attribute codes old nodes cannot parse; corrupted attribute blobs in storage; manual buffer slicing bugs in custom code.

Related errors


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