{"record":{"id":"8357f6218c3d3002","repo":"aeron-io/aeron","slug":"expected-timestamp","errorCode":null,"errorMessage":"Expected timestamp","messagePattern":"Expected timestamp","errorType":"validation","errorClass":"InvalidMessage","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/logging/CborDecode.java","lineNumber":133,"sourceCode":"    private void parseString(final DecodingState state, final AsciiSequenceView asciiSequenceView)\n    {\n        state.ensureRemaining(1);\n        final int eventCodeNameTypeByte = (0xFF) & state.buffer().getByte(state.offset());\n        state.incrementOffset(1);\n        parseString(state, asciiSequenceView, additionalContent(eventCodeNameTypeByte));\n    }\n\n    private long parseLong(final DecodingState state)\n    {\n        state.ensureRemaining(1);\n        final int typeByte = (0xFF) & state.buffer().getByte(state.offset());\n        state.incrementOffset(1);\n        final int majorType = majorType(typeByte);\n        final int additionalContent = additionalContent(typeByte);\n\n        if (NEGATIVE_INTEGER_MAJOR_TYPE != majorType && UNSIGNED_INTEGER_MAJOR_TYPE != majorType)\n        {\n            throw new InvalidMessage(\"Expected timestamp\");\n        }\n\n        return parseNumber(state, majorType, additionalContent);\n    }\n\n    private boolean parseBoolean(final DecodingState state)\n    {\n        state.ensureRemaining(1);\n        final int typeByte = (0xFF) & state.buffer().getByte(state.offset());\n        state.incrementOffset(1);\n        final int majorType = majorType(typeByte);\n        final int additionalContent = additionalContent(typeByte);\n\n        if (SIMPLE_VALUE_MAJOR_TYPE != majorType ||\n            (ADDITIONAL_CONTENT_TRUE != additionalContent && ADDITIONAL_CONTENT_FALSE != additionalContent))\n        {\n            throw new InvalidMessage(\"Expected boolean\");\n        }","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/logging/CborDecode.java#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the log source is a complete, uncorrupted Aeron logger stream and start decoding at offset 0","Ensure the decoder version matches the Aeron version that produced the log (CBOR schema compatibility)","Wrap decoding in error handling for CborDecode.InvalidMessage and log the offset to diagnose where the stream diverges"],"exampleFix":"// before\nfinal long ts = cborDecode.parseLong(state); // throws if stream is misaligned\n// after\ntry\n{\n    final long ts = cborDecode.parseLong(state);\n}\ncatch (final CborDecode.InvalidMessage ex)\n{\n    LOG.error(\"bad CBOR stream at offset \" + state.offset() + \": \" + ex.getMessage());\n}","handlingStrategy":"try-catch","validationCode":"// check stream integrity before decode\nif (buffer.capacity() - offset < 1) throw new IllegalStateException(\"log stream truncated before timestamp\");","typeGuard":null,"tryCatchPattern":"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); }","preventionTips":["Decode complete recordings from offset 0; never resume mid-item","Match decoder version to logger version","Log offsets on failure for diagnosis"],"tags":["aeron","cbor","logging","deserialization"],"backgroundTag":"unexpected-response-shape","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}