Animation not working, invalid layer index "-1"

With this script, i get infinite invalid layer index errors and the animation doesn’t play:

 using UnityEngine;
 using System.Collections;
 
 public class Stalker : MonoBehaviour
 {
	public Animator anim;
     public float followSpeed = 0.1f;

     public Transform followTarget;

	void Awake ()
	{
	anim = GetComponent<Animator>();
	}

     void Update ()
     {
         this.Follow (this.followTarget, fSpeed: this.followSpeed);
     }
 
     void Follow (Transform target, float fSpeed = 1)
     {
         
         Vector3 newPosition = Vector3.MoveTowards(this.transform.position, target.position, fSpeed * Time.deltaTime);

	anim.Play ("HumanoidRun");

         this.transform.position = newPosition;
         this.transform.LookAt (target.position, this.transform.up);
     }
 }

Why? What is the proper way to do this? I already watched the tutorial on animator scripting.
Please help!

Hum. Do you have only 1 movement animation? By the look of this script I would guess so.
Also it looks like your using the new Mecanim system is that right? So your using the following

anim.Play ("HumanoidRun");

Which is the following

public void Play(string stateName, int layer = -1, float normalizedTime = float.NegativeInfinity);

Doc found here: Unity - Scripting API: Animator.Play

However it would be a lot easier to go from your idle animation to a running animation using a bool or speed.

Play animation based on speed

private Vector3 lastPos = Vector3.zero;		//for speed calculation
private float moveSpeed = 0.0f;//declare variable

//how fast player going, place in Update()?
moveSpeed = Vector3.Distance (lastPos, this.transform.position) / Time.deltaTime;
lastPos = this.transform.position;
anim.SetFloat("speed",moveSpeed);

So open your animator and add the “speed” float and play it when it is greater than 0.1 for example. For a blend tree you would want to have a direction parameter as well as a speed parameter.

So with that all said change

void Update ()
      {
          this.Follow (this.followTarget, fSpeed: this.followSpeed);
      }

To

void Update() { 
    //how fast player going, place in Update()?
     moveSpeed = Vector3.Distance (lastPos, this.transform.position) / Time.deltaTime;
     lastPos = this.transform.position;
     anim.SetFloat("speed",moveSpeed);
     this.Follow (this.followTarget, fSpeed: this.followSpeed);
}

and add the following to the top of the script

 private Vector3 lastPos = Vector3.zero;		//for speed calculation
 private float moveSpeed = 0.0f;//declare variable