Why does my cast fail

What it means is the thing you’re casting is not of the type you’re trying to cast to.

Can I see the code?