Same problem in 5.4. Did a lot of head scratching on this one since I spawn it in the normal way via blueprints BUT my widget is 100% C++ except for the visual stuff and everything thus happens in C++, including the remove from parent call.
In my case, I had the root of my Widget as a variable and called MyRoot->RemoveFromParent() and that didn’t work so I looked at the part of the error that speaks of the UMG parent and thought to myself “Let’s try something” and so I replaced that line with this (literally)
this->RemoveFromParent();
…and that worked perfectly! Yeay!
…and then I realized the “this->” is probably pointless also. Could just call RemoveFromParent directly and job done.
I think the problem in my case was that I created a variable pointing to the root ELEMENT inside my widget and called THAT to remove itself from the parent. I didn’t actually call my WIDGET and tell IT to remove itself from parent.
Ahhhh… Mystery solved