Animator is not playing an AnimatorController in Animator Controller

I am learning how to control the transition from the idle state to the walk state through a blend tree. I wrote a script that is attached to the PlayerHandler, which automatically acquires animations and playerInput on this model by specifying the model type.

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ActorController : MonoBehaviour {

	public GameObject model;
    public PlayerInput pi;

	private Animator anim;

	// Use this for initialization
	void Awake () {
        pi = GetComponent<PlayerInput>();
        anim = model.GetComponent<Animator>();
	// Update is called once per frame
	void Update () {
        anim.SetFloat("forward", pi.Dup);

When I was debugging, I commented out anim.SetFloat("forward", pi.Dup); and tested it, and observed that all components could correctly retrieve the value.

However, as soon as I add this line of code, it shows:

“Animator is not playing an AnimatorController” UnityEngine.Animator:SetFloat(String, Single)

What is going on here?

Why can’t I get it after adding this line?