Return 400 response code if query is invalid