Sometimes it can happen, that a spy gets detected and killed or deserts to the enemy and leaks information about you. Sadly there is nothing you can do to prevent this, since using a spy is always tied to a certain risk. All you can do is try it again and hope, the next spy is more capable or loyal to you.