It is possible that the shrimp were the host species, not the fish. I've seen shrimp only tanks, getting infested with Planaria. Used to see tanks of shrimps at Polyart with a ton of Planaria.
If you need to remove them, you need an anti-helminthic like flubendazole or fenbendazole.
Bookmarks