dianping/cat · critical · RuntimeException
Unknown identifier int name
Error message
Unknown identifier int name
What it means
PlainTextMessageCodec.decodeLine switches on a single-byte identifier at the start of each line ('t','T','E','M','H','L'...). The default branch throws RuntimeException("Unknown identifier int name") — the message text is garbled ('int name' for 'identifier') and omits the byte value, but the cause is always a line that starts with an unexpected character.
Source
Thrown at cat-core/src/main/java/com/dianping/cat/message/codec/PlainTextMessageCodec.java:268
tree.findOrCreateHeartbeats().add(heartbeat);
String heartbeatStatus = helper.read(ctx, TAB);
String heartbeatData = helper.read(ctx, TAB);
helper.read(ctx, LF); // get rid of line feed
heartbeat.setTimestamp(m_dateHelper.parse(timestamp));
heartbeat.setStatus(heartbeatStatus);
heartbeat.addData(heartbeatData);
if (parent != null) {
parent.addChild(heartbeat);
return parent;
} else {
return heartbeat;
}
default:
throw new RuntimeException("Unknown identifier int name");
}
}
protected void decodeMessage(Context ctx, MessageTree tree) {
Stack<DefaultTransaction> stack = new Stack<DefaultTransaction>();
Message parent = decodeLine(ctx, null, stack, tree);
tree.setMessage(parent);
while (ctx.getBuffer().readableBytes() > 0) {
Message message = decodeLine(ctx, (DefaultTransaction) parent, stack, tree);
if (message instanceof DefaultTransaction) {
parent = message;
} else {
break;
}
}View on GitHub (pinned to e815e74d4c)
Solutions
- Enable a hex/UTF-8 dump of the buffer at the failure point to see which character was read (the exception does not include it).
- Strip or escape CR/LF in message data strings on the producer side so lines stay intact.
- Align client and server versions so both understand the same identifier set.
- If constructing payloads manually, start each line with a valid identifier byte ('t','T','E','M','H','L').
Example fix
// before: raw newline inside data breaks next line's identifier
String data = "a\nb"; // next line begins 'b' -> Unknown identifier
// after: sanitize
String data = raw.replace('\n', ' ').replace('\r', ' '); Defensive patterns
Strategy: try-catch
Try / catch
catch (RuntimeException e) { if ("Unknown identifier int name".equals(e.getMessage())) { abort decoding this payload; log buffer hexdump; } else throw e; } Prevention
- Sanitize CR/LF out of all message data fields before they enter the wire format.
- Keep identifier byte vocabulary in sync across versions.
- Log the failing byte offset — the exception omits the offending character.
When it happens
Trigger: Decoding a PT1 payload where a line's leading byte is not a known identifier: line desynchronization (a field containing an embedded newline), truncation, or version drift adding a new line type this codec does not support.
Common situations: Event/transaction data strings containing raw newline characters that break the line-oriented format; mixed client/server versions introducing new record types; hand-crafted test payloads with wrong tags.
Related errors
- Unrecognized id(%s) for plain text message codec!
- Error message type : %s
- Unsupported message type(%s).
- Unrecognized version(%s) for binary message codec!
- Malformed variable int %s!
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/01bad5a7e4c99a10.
Report an issue: GitHub.