If you look at my session state video that focuses on modifying the behavior of widgets, you can see how even when a widget fully deleted by being removed from the page, there’s a kind of “one load delay” for it to really be gone. (You see it around the 10 minute mark when I nest the checkboxes.)
If a widget is deleted, you need to reload the page before recreating it for Streamlit to recognize it as deleted.
Did you link the rest of your code somewhere? The bit in the OP wasn’t enough to reproduce the error, so if you can provide enough code for the community to execute and get the error, then you’ll likely get a clearer answer.