That will attempt to cast on your target’s target regardless of reaction (healer targeting an ally for instance).
You’d be better off with:
#showtooltip
/cast [harm] [@targettarget,harm,nodead] [] Frostbolt
This version will also generate the correct range finding tooltip for @targettarget
mobs vs hard coding the tooltip to the spell which will only range find to your target.
If you’re after more templates: