returns error if no messages in the queue