Why did my virus get lost?

If you use a virus on a recently flipped (in the last hour) portal your virus will be consumed without a warning. You'll only get a message after using the virus telling you that the targeted portal is immune to the process.

This from a formal Ingress post :

Portals now have a temporary 1 hour immunity to ADA Refactor and JARVIS Virus weapons after a Refactor or Virus has been deployed. If immune, Agents should see: "Failed. Portal Temporarily Immune."

This is important: Failed attempts to use an ADA Refactor or JARVIS Virus weapon will consume the Refactor and Virus, removing it from your inventory.

https://plus.googleapis.com/+Ingress/posts/U6TfcW5KuS3