I’m not familiar with Ray Tune, but it seems that result.get_best_trial doesn’t return anything so that best_trial is a None object and lets the following operation fail.
Based on the docs it seems that the return value is optional and also the source 1 shows that best_trial might be None and will raise a warning:
        if not best_trial:
            logger.warning(
                "Could not find best trial. Did you pass the correct `metric` "
                "parameter?")
        return best_trial