What happens when you cast a spell which targets X on a target which is something other than X. For example, what would happen if I attempted to cast charm person on a shapeshifted rakshasha?
I'm guessing the spell is successfully cast, but simply has no effect on the target, and the caster realizes this (as opposed to thinking the target simply made his save).
However, other possibilities occur to me. Since the target is invalid, can the target even be targeted? If so, upon realizing this, can the caster then select a different target upon casting the spell?
Perhaps there's something else I haven't thought of.
If you ever try to cast a spell in conditions where the characteristics of the spell cannot be made to conform, the casting fails and the spell is wasted.
Spells also fail if your concentration is broken and might fail if you're wearing armor while casting a spell with somatic components.
So, casting a spell that only affects creature type X on something other then creature type X causes the spell to fail and be lost.
Similarly, what happens when you think you have line of effect to a target but do not? Such as through a Wall of Force or just an invisible stone wall?
I would say that qualifies as "conditions where the characteristics of the spell cannot be made to conform", and so the spell fails and is wasted.