Buggy code:
class StatelessServerConnector < K , V > { private static final Logger LOG = LoggerFactory . getLogger ( StatelessServerConnector . class . getName ( ) ) ; public static final EventId [ ] VALUES = EventId . values ( ) ; public static final int SIZE_OF_IS_EXCEPTION = 1 ; public static final int HEADER_SIZE = ( ( AbstractChannelReplicator . SIZE_OF_SIZE ) + ( StatelessServerConnector . SIZE_OF_IS_EXCEPTION ) ) + ( AbstractChannelReplicator . SIZE_OF_TRANSACTION_ID ) ; @ NotNull private final ReaderWithSize < K > keyReaderWithSize ; @ NotNull private final WriterWithSize < K > keyWriterWithSize ; @ NotNull private final ReaderWithSize < V > valueReaderWithSize ; @ NotNull private final WriterWithSize < V > valueWriterWithSize ; @ NotNull private final VanillaChronicleMap < K , ? , ? , V , ? , ? > map ; private final SerializationBuilder < K > keySerializationBuilder ; private final SerializationBuilder < V > valueSerializationBuilder ; private final int tcpBufferSize ; StatelessServerConnector ( @ NotNull VanillaChronicleMap < K , ? , ? , V , ? , ? > map , @ NotNull final BufferResizer bufferResizer , int tcpBufferSize , final SerializationBuilder < K > keySerializationBuilder , final SerializationBuilder < V > valueSerializationBuilder ) { } @ Nullable Work processStatelessEvent ( final byte eventId , @ NotNull final TcpReplicator . TcpSocketChannelEntryWriter writer , @ NotNull final ByteBufferBytes reader ) { } private void writeObject ( TcpReplicator . TcpSocketChannelEntryWriter writer , Object o ) { } private Work writeBuilder ( TcpReplicator . TcpSocketChannelEntryWriter writer , long sizeLocation , SerializationBuilder builder ) { } @ Nullable public Work mapForKey ( @ NotNull ByteBufferBytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , long sizeLocation ) { } @ Nullable public Work putMapped ( @ NotNull ByteBufferBytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , long sizeLocation ) { } @ Nullable private Work removeWithValue ( Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ Nullable private Work replaceWithOldAndNew ( Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ Nullable private Work longSize ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work hashCode ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work toString ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work applicationVersion ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work persistedDataVersion ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ SuppressWarnings ( "SameReturnValue" ) @ Nullable private Work sendException ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , long sizeLocation , @ NotNull Throwable e ) { writer . in ( ) . position ( ( sizeLocation + ( StatelessServerConnector . HEADER_SIZE ) ) ) ; writeException ( writer , e ) ; <START_BUG> writeSizeAndFlags ( ( sizeLocation + ( AbstractChannelReplicator . SIZE_OF_TRANSACTION_ID ) ) , true , writer . in ( ) ) ; <END_BUG> return null ; } @ Nullable private Work isEmpty ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work containsKey ( Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work containsValue ( Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation ) { } @ Nullable private Work get ( Bytes reader , TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long transactionId ) { } @ SuppressWarnings ( "SameReturnValue" ) @ Nullable private Work put ( Bytes reader , long timestamp , byte id ) { } @ Nullable private Work put ( Bytes reader , TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ SuppressWarnings ( "SameReturnValue" ) @ Nullable private Work remove ( Bytes reader , long timestamp , byte id ) { } @ Nullable private Work remove ( Bytes reader , TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ Nullable private Work putAll ( @ NotNull Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ SuppressWarnings ( "SameReturnValue" ) @ Nullable private Work putAll ( @ NotNull Bytes reader , long timestamp , byte id ) { } @ Nullable private Work clear ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ Nullable private Work values ( @ NotNull Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long transactionId ) { } @ Nullable private Work keySet ( @ NotNull Bytes reader , @ NotNull final TcpReplicator . TcpSocketChannelEntryWriter writer , final long transactionId ) { } @ Nullable private Work entrySet ( @ NotNull final Bytes reader , @ NotNull TcpReplicator . TcpSocketChannelEntryWriter writer , final long transactionId ) { } @ Nullable private Work putIfAbsent ( Bytes reader , TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } @ Nullable private Work replace ( Bytes reader , TcpReplicator . TcpSocketChannelEntryWriter writer , final long sizeLocation , long timestamp , byte id ) { } private long reflectTransactionId ( @ NotNull Bytes writer , final long transactionId ) { } private void writeSizeAndFlags ( long locationOfSize , boolean isException , @ NotNull Bytes out ) { } private void writeException ( @ NotNull TcpReplicator . TcpSocketChannelEntryWriter out , Throwable e ) { } @ NotNull private Map < K , V > readEntries ( @ NotNull Bytes reader ) { }

Fix:
writeSizeAndFlags ( sizeLocation , true , writer . in ( ) ) ;