ArgumentException: You have already claimed the path with that object.. Are you claiming the path

First time it happen to me.
I’ve got this exception:

ArgumentException: You have already claimed the path with that object (HumanMove (Seeker)). Are you claiming the path with the same object twice?
Pathfinding.Path.Claim (System.Object o) (at Assets/AstarPathfindingProject/Core/Path.cs:470)
Seeker.OnPathComplete (Pathfinding.Path p, Boolean runModifiers, Boolean sendCallbacks) (at Assets/AstarPathfindingProject/Core/AI/Seeker.cs:293)
Seeker.OnPathComplete (Pathfinding.Path p) (at Assets/AstarPathfindingProject/Core/AI/Seeker.cs:263)
Pathfinding.Path.ReturnPath () (at Assets/AstarPathfindingProject/Core/Path.cs:637)
AstarPath.ReturnPaths (Boolean timeSlice) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:2010)
AstarPath+c__IteratorC.MoveNext () (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1962)

And after that the pathfinding don’t work anymore.

Do you have an idea of why ?

Are you requesting StartPath with the same path object twice?
Or are you calling mypath.Claim with the Seeker object?

That error is there to prevent pooling errors, when the same object says more than once that it want an object to be alive, it will log this error.

` public void GoTo( Vector3 vTargetPosition)
{
if ( m_bCalculatingPathFind && ( ( m_fTimeLastPathFindCalculate + F_MAX_PATHFIND_DURATION_CALCULATION ) > Time.time) )//already searching one pathfind (wait for it’s completion)
{
m_bNewTargedtInQueue = true;
m_newTargetInQueue = vTargetPosition;
}
else
{
Path newPath = m_oSeeker.GetNewPath (m_oMoverGameObject.transform.position, vTargetPosition);
newPath.nnConstraint = NNConstraint.Default;
newPath.nnConstraint.constrainDistance = false;

		// start pathfinding
		m_oSeeker.StartPath( newPath, OnPathComplete, -1);
		m_bCalculatingPathFind = true;
		m_fTimeLastPathFindCalculate = Time.time;
			
		m_vLastTarget = vTargetPosition;
		m_bHasTarget = true;
		
		m_sNBPathFindingCalculating++;
	}
}`

and the function when the path is complete

` public void OnPathComplete (Path oPath)
{
m_sNBPathFindingCalculating–;

   // Debug.Log ("Yey, we got a path back. Did it have an error? "+p.error);
    if (!oPath.error) 
	{
		//Release the previous path
		if (m_oPath != null) m_oPath.Release (this);
		
		//Claim the new path
		oPath.Claim (this);
		
		//Replace the old path
		m_oPath = oPath;
		
		if ( m_oPath.vectorPath.Count > 0 )
		{
			int iClosestPoint = GetClosestPointIndexFromPosition();
			
			for (int i = 0; i < iClosestPoint + 1; i++ )
			{
				// start the path at the current position
				m_oPath.vectorPath[i] = m_oMoverGameObject.transform.position;
			}

			
		}
		
		m_iCurrentPathGoToId = m_iNextPathGotoId;
		
        OnPathFound();

    }
	else
	{
		Debug.Log ("Path error " + oPath.error);
	}
	
	m_bCalculatingPathFind = false;
	m_fTimeLastPathFindCalculate = 0.0f;

	//manage on queue
	if ( m_bNewTargedtInQueue  )
	{
		GoTo(m_newTargetInQueue );
		m_bNewTargedtInQueue = false;			
	}
	
}`

It happens once, but it screw the entire pathfinding system and nothing was moving anymore

Hm… that looks weird.
I cannot see anything wrong in the code.

Would it be possible for you to send me a zipped project in which I can reproduce the bug?
Also, try the beta if it is available for you, it might be a bug that has been fixed.

To avoid this being a showstopper, just comment out all the Claim and Release calls in your code. It will not be as memory (GC) efficient, but at least it won’t crash.

Never got this bug again, so I close it.