guard when id or query are empty or undefined