this helper function needs to provide a more general error message