aeron-io/aeron · error · InvalidMessage
Invalid value length
Error message
Invalid value length
What it means
parseNumber in CborDecode requires the CBOR additional-info bits to encode either an inline value or 1, 2, 4, or 8 following bytes. Any other additional-content value (the reserved/invalid lengths like 7 for integer major types, or >7 non-standard) hits the else branch and throws. The number is otherwise read big-endian and negated for negative-integer major type.
Solutions
- Ensure the CBOR payload encodes integers with additional-info 24/25/26/27 (1/2/4/8 bytes) or inline (<24).
- Re-capture the event log with matching encoder/decoder versions.
- Validate the buffer offset alignment before parseNumber runs.
- Patch parseNumber to accept additional encodings if your encoder emits them.
Example fix
// before
else
{
throw new InvalidMessage("Invalid value length");
}
// after
else
{
throw new InvalidMessage("Invalid CBOR integer additional-info value=" + valueAdditionalContent);
} Defensive patterns
Strategy: try-catch
Validate before calling
// verify additional-info bits of the number header are a supported width
final int extraInfo = buffer.getByte(offset) & 0b000_11111;
if (extraInfo > 27 || (extraInfo >= 7 && extraInfo <= 23)) { /* unsupported width */ } Type guard
boolean isSupportedCborIntegerEncoding(final byte headerByte)
{
final int info = headerByte & 0b000_11111;
return info < 24 || info == 24 || info == 25 || info == 26 || info == 27;
} Try / catch
try
{
value = CborDecode.parseLong(state);
}
catch (final InvalidMessage ex)
{
LOGGER.warn("bad integer encoding at offset " + state.offset());
return false;
} Prevention
- Encode integers with standard CBOR width prefixes (24-27).
- Match encoder/decoder versions.
- Start decode at the exact record boundary.
- Catch InvalidMessage per record so parsing continues.
When it happens
Trigger: CBOR integer whose additional-info byte is not 0-7-compatible with the supported widths — e.g. value 7 (float/simple encoding) on a 0/1 major type, or a corrupt length byte in the log buffer.
Common situations: Decoding logs produced by non-standard CBOR encoders; corrupted capture buffers; hand-crafted CBOR in tests; decoder pointed at wrong offset so a float header is read as an integer.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12).
Data as JSON: /api/errors/b8ac20051516912e.
Report an issue: GitHub.
Appendix: source
Thrown at aeron-client/src/main/java/io/aeron/logging/CborDecode.java:307
state.ensureRemaining(2);
value = 0xFFFF & state.buffer().getShort(state.offset(), BIG_ENDIAN);
state.incrementOffset(2);
}
else if (ADDITIONAL_CONTENT_4_BYTE == valueAdditionalContent)
{
state.ensureRemaining(4);
value = 0xFFFFFFFFL & state.buffer().getInt(state.offset(), BIG_ENDIAN);
state.incrementOffset(4);
}
else if (ADDITIONAL_CONTENT_8_BYTE == valueAdditionalContent)
{
state.ensureRemaining(8);
value = state.buffer().getLong(state.offset(), BIG_ENDIAN);
state.incrementOffset(8);
}
else
{
throw new InvalidMessage("Invalid value length");
}
if (NEGATIVE_INTEGER_MAJOR_TYPE == valueMajorType)
{
value = ~value;
}
return value;
}
private void parseByteArray(
final DecodingState state,
final DirectBuffer targetBuffer,
final int keyAdditionalContent)
{
if (keyAdditionalContent < ADDITIONAL_CONTENT_1_BYTE)
{
targetBuffer.wrap(state.buffer(), state.offset(), keyAdditionalContent);View on GitHub (pinned to 6d60124e15)