better error message for missing query