QUESTION: How to delete an invalid entity with no unique ID (UNSOLVED)

I had the same problem, what probably fixed it is that I opened home-assistant_v2.db with the SQLite extension in VSCode and did a cleanup in the states table. After restarting HA several times, and logging out and in again, the entities were finally gone. Hope it helps someone.