I'm removing components like so in the on_replace and on_remove hooks for a component. They're guarded and I'm checking for the existence of the entity beforehand.
if let Ok(mut entcmds) = world.commands().get_entity(ent) {
entcmds.remove::<BackgroundColor>();
entcmds.remove::<ImageNode>();
}
This still results in ECS Error logs:
2025-05-03T17:04:32.366610Z WARN bevy_ecs::error::handler: Encountered an error in command `<bevy_ecs::system::commands::entity_command::remove<bevy_ui::widget::image::ImageNode>::{{closure}} as bevy_ecs::error::command_handling::CommandWithEntity<core::result::Result<(), bevy_ecs::world::error::EntityMutableFetchError>>>::with_entity::{{closure}}`: The entity with ID 631v429 does not exist (index has been reused or was never spawned)
Is there something I'm doing wrong; I'd expect to just not enter the conditional block if the entity doesn't exist.