aeron-io/aeron · error · InvalidMessage

Expected timestamp

Error message

Expected timestamp

What it means

CborDecode.parseLong parses a CBOR major-type 0 (unsigned integer) or 1 (negative integer) item expected to be a timestamp. If the next byte's major type is not an integer (e.g. a text string or array), it throws InvalidMessage('Expected timestamp'), meaning the logged binary stream is not shaped as the logger wrote it.

Solutions

  1. Verify the log source is a complete, uncorrupted Aeron logger stream and start decoding at offset 0
  2. Ensure the decoder version matches the Aeron version that produced the log (CBOR schema compatibility)
  3. Wrap decoding in error handling for CborDecode.InvalidMessage and log the offset to diagnose where the stream diverges

Example fix

// before
final long ts = cborDecode.parseLong(state); // throws if stream is misaligned
// after
try
{
    final long ts = cborDecode.parseLong(state);
}
catch (final CborDecode.InvalidMessage ex)
{
    LOG.error("bad CBOR stream at offset " + state.offset() + ": " + ex.getMessage());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// check stream integrity before decode
if (buffer.capacity() - offset < 1) throw new IllegalStateException("log stream truncated before timestamp");

Try / catch

try { final long timestamp = cborDecode.parseLong(state); } catch (final CborDecode.InvalidMessage ex) { throw new LogDecodeException("corrupt or misaligned logger stream at offset " + state.offset(), ex); }

Prevention

When it happens

Trigger: Decoding a log buffer/recording whose byte at the current offset is not a CBOR integer where a timestamp (or event code) is expected — e.g. misaligned stream, truncated/corrupt file, or decoding output from an incompatible logger version.

Common situations: Pointing a log decoder at a partially written file, mixing log formats across Aeron versions, or an off-by-N seek that shifts CBOR item boundaries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/8357f6218c3d3002. Report an issue: GitHub.

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/logging/CborDecode.java:133

    private void parseString(final DecodingState state, final AsciiSequenceView asciiSequenceView)
    {
        state.ensureRemaining(1);
        final int eventCodeNameTypeByte = (0xFF) & state.buffer().getByte(state.offset());
        state.incrementOffset(1);
        parseString(state, asciiSequenceView, additionalContent(eventCodeNameTypeByte));
    }

    private long parseLong(final DecodingState state)
    {
        state.ensureRemaining(1);
        final int typeByte = (0xFF) & state.buffer().getByte(state.offset());
        state.incrementOffset(1);
        final int majorType = majorType(typeByte);
        final int additionalContent = additionalContent(typeByte);

        if (NEGATIVE_INTEGER_MAJOR_TYPE != majorType && UNSIGNED_INTEGER_MAJOR_TYPE != majorType)
        {
            throw new InvalidMessage("Expected timestamp");
        }

        return parseNumber(state, majorType, additionalContent);
    }

    private boolean parseBoolean(final DecodingState state)
    {
        state.ensureRemaining(1);
        final int typeByte = (0xFF) & state.buffer().getByte(state.offset());
        state.incrementOffset(1);
        final int majorType = majorType(typeByte);
        final int additionalContent = additionalContent(typeByte);

        if (SIMPLE_VALUE_MAJOR_TYPE != majorType ||
            (ADDITIONAL_CONTENT_TRUE != additionalContent && ADDITIONAL_CONTENT_FALSE != additionalContent))
        {
            throw new InvalidMessage("Expected boolean");
        }

View on GitHub (pinned to 6d60124e15)