Handle error for missing queries