The most common cause of this error is assuming that a "Game Over" or "Wave Complete" event means the playing field is actually empty.
Add a check before spawning:
This appears to be a message from a , roguelite , or wave-based survival game (e.g., Orcs Must Die! , Dungeon Defenders , Sanctum , GemCraft , or a custom map in Warcraft III /StarCraft II). The most common cause of this error is