handling invalid query id