How to Serial read two consecutive chars sent by computer to Arduino?
Presuming that code is the interior of loop(), your Arduino will spin until a character arrives, that is, until Serial.available()&gt;0 becomes true.

It then reads the character with Serial.read() and if it's an 'a' immediately does another Serial.read().  In general, some delay occurs between characters arriving via a serial interface.  Whenever the serial buffer is empty, an immediate Serial.read() will return -1 instead of an ASCII character.

To fix this problem, test for availability of a character before doing the second read.  For example, you could add

while (!Serial.available()){}


before the read, to delay until a character is available.