I'd need to see more code to understand how that situation is arising, but on initial view, the question would be, why not
queue_free() the collider after causing the damage?
I'm not the foremost expert in the inner workings of Godot, but I was under the impression that the
queue_free() worked on a frame basis, so should only be actioned at the end of the frame, after all the scripts had completed, so I'm not sure how it's possible to happen between lines of the code.
Perhaps another avenue to explore is to check
Object.is_queued_for_deletion() on the collder before trying to call it. However, this feels like a hack, I'd want to understand how it's possible that the collider can disappear between lines of code.