only return error 500 when request is invalid