animator has not been initialized

I get this error
Animator has not been initialized.
UnityEngine.Animator:SetBool(String, Boolean)
Player:UpdateControls() (at Assets/scripts/Player.cs:36)
Player:Update() (at Assets/scripts/Player.cs:21)

link to script:

I just had the same issue, it was my fault because I forgot one object in the scene without the Animator, one object lost its relation to the prefab. The new ones were fine.