{"record":{"id":"54fcd01698518649","repo":"aeron-io/aeron","slug":"expected-boolean","errorCode":null,"errorMessage":"Expected boolean","messagePattern":"Expected boolean","errorType":"validation","errorClass":"InvalidMessage","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/logging/CborDecode.java","lineNumber":150,"sourceCode":"        {\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        }\n\n        return additionalContent == ADDITIONAL_CONTENT_TRUE;\n    }\n\n    private void parseSimpleValue(final DecodingState state, final int additionalContent)\n    {\n        switch (additionalContent)\n        {\n            case ADDITIONAL_CONTENT_FALSE:\n            case ADDITIONAL_CONTENT_TRUE:\n                for (int i = 0, n = loggers.size(); i < n; i++)\n                {\n                    final LoggerEventCallback logger = loggers.get(i);\n                    logger.onValue(keyAsciiView, NO_TAG, additionalContent == ADDITIONAL_CONTENT_TRUE);\n                }\n                break;\n            case ADDITIONAL_CONTENT_NULL:","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/logging/CborDecode.java#L132-L168","documentation":"CborDecode.parseBoolean expects a CBOR major type 7 (simple value) with additional content 20 (false) or 21 (true). Any other type at the current offset — including null, undefined, or an integer — triggers InvalidMessage('Expected boolean'). The binary stream deviates from the expected logger field layout.","triggerScenarios":"Decoding a logger stream where a boolean field (e.g. 'truncated') is absent, corrupted, or replaced by another CBOR type due to version mismatch or stream corruption/misalignment.","commonSituations":"Replaying truncated recordings, decoding logs written by a newer Aeron logger with extra fields, or resuming decode mid-item after an earlier parse error.","solutions":["Confirm the decoder and logger versions match and restart decode from the beginning of the stream","Check the source file/buffer for truncation or corruption before decoding","Catch CborDecode.InvalidMessage around field parses and resynchronize or abort with offset context"],"exampleFix":"// before\nfinal boolean truncated = cborDecode.parseBoolean(state);\n// after\nfinal int typeByte = state.peekByte(); // validate major type 7 (0xE0-0xFF range) before parsing\nfinal boolean truncated = cborDecode.parseBoolean(state);","handlingStrategy":"try-catch","validationCode":"// peek major type 7 (0xE0..0xF8) before parsing a boolean\nfinal int typeByte = state.buffer().getByte(state.offset());\nfinal boolean looksBoolean = (typeByte & 0xE0) == 0xE0;","typeGuard":null,"tryCatchPattern":"try { final boolean truncated = cborDecode.parseBoolean(state); } catch (final CborDecode.InvalidMessage ex) { throw new LogDecodeException(\"expected CBOR boolean at offset \" + state.offset(), ex); }","preventionTips":["Keep logger and decoder versions identical","Fail fast on the first InvalidMessage instead of continuing a misaligned decode","Validate recordings (size/hash) before replay"],"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"}