Added a more informative exception for attempting to replace traj