aeron-io/aeron · error · IllegalArgumentException
Invalid typeCode=
Error message
Invalid typeCode=${typeCode} What it means
EventCodeType.get maps a numeric typeCode to an EventCodeType enum constant (DRIVER=0, ARCHIVE=1, CLUSTER=2, STANDBY=3, SEQUENCER=4, USER=0xFFFF). An unknown code throws IllegalArgumentException('Invalid typeCode=...'), meaning the event log contains a type code this Aeron version does not recognize.
Solutions
- Upgrade to the Aeron version matching the one that produced the event log.
- Log and skip records with unknown type codes instead of failing the whole decode.
- Verify the type code is read from the correct header offset.
- If adding a custom type, register it in the EventCodeType switch.
Example fix
// before
final EventCodeType type = EventCodeType.get(typeCode); // throws on unknown
// after
try
{
final EventCodeType type = EventCodeType.get(typeCode);
}
catch (final IllegalArgumentException ex)
{
LOGGER.warn("skipping unknown event typeCode=" + typeCode);
return;
} Defensive patterns
Strategy: try-catch
Validate before calling
static boolean isKnownTypeCode(final int typeCode)
{
return typeCode >= 0 && typeCode <= 4 || typeCode == 0xFFFF;
} Type guard
boolean isValidEventCodeType(final int typeCode)
{
return (typeCode >= 0 && typeCode <= 4) || typeCode == 0xFFFF;
} Try / catch
try
{
final EventCodeType type = EventCodeType.get(typeCode);
// process record
}
catch (final IllegalArgumentException ex)
{
LOGGER.warn("unknown event typeCode=" + typeCode + ", skipping record");
} Prevention
- Run capture and decode tooling from the same Aeron version.
- Validate header bytes come from the correct offset.
- Skip unknown type codes defensively to stay forward-compatible.
- Upgrade Aeron when logs contain unrecognized codes.
When it happens
Trigger: Decoding an event log written by a newer Aeron version that introduced a new type code; passing a raw byte/int from user data as a type code; reading a corrupted header byte.
Common situations: Version mismatch between capture tooling and this library; manually constructed event headers with bad codes; forward-compatibility gaps after an Aeron upgrade.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- ClusterBackup.Context.sourceType=
- CnC version not compatible: app=
- - code must equal ordinal value: code=
- driverVersion= insufficient for clientVersion=
- EINVAL
AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12).
Data as JSON: /api/errors/52e0594bd66d6b97.
Report an issue: GitHub.
Appendix: source
Thrown at aeron-client/src/main/java/io/aeron/logging/EventCodeType.java:87
/**
* Get the EventTypeCode based on the matching typeCode value.
*
* @param typeCode used to resolve the EventTypeCode.
* @return the resolved EventTypeCode.
* @throws IllegalArgumentException if the typeCode does not match one of the enum values.
*/
public static EventCodeType get(final int typeCode)
{
return switch (typeCode)
{
case 0 -> DRIVER;
case 1 -> ARCHIVE;
case 2 -> CLUSTER;
case 3 -> STANDBY;
case 4 -> SEQUENCER;
case 0xFFFF -> USER;
default -> throw new IllegalArgumentException("Invalid typeCode=" + typeCode);
};
}
}
View on GitHub (pinned to 6d60124e15)