So a proof might claim to prove a theorem about a whole class of numbers or other mathematical objects. But if there is bug in one of its lemmas it would mean its results are true of only a subset of the mathematical objects claimed. That would be like getting an error on specific inputs.
The proof then remains a valid proof of something although not exactly a proof of everything its authors claim it to be a proof of.
An erroneous proof is also usually useful because it is not clearly wrong in most cases since nobody has come up with counter-examples so far that would prove the proof incorrect, yet.
I don't think it's necessarily like that. The error could make the theorem wrong in all cases.
I think it's more that the mathematician has a top-down way of reasoning, where they can see things like "I want to get from New York City to Los Angeles, so I have to board the bus, take a flight, and then take the bus from the airport at LA". There are certain parts where you basically know that a proof will be possible, because it seems true, like "I can get to LA's airport with public transit", so usually a specific hiccup, like a bus being delayed, won't prevent you from getting there.
Right, it's possible to get to LA's airport with public transit, but the amount of time it takes cannot be upper bounded using currently known techniques.
The proof then remains a valid proof of something although not exactly a proof of everything its authors claim it to be a proof of.
An erroneous proof is also usually useful because it is not clearly wrong in most cases since nobody has come up with counter-examples so far that would prove the proof incorrect, yet.