When a colleague points out a mistake you made, is it too formal to respond: "Thanks for alerting me to this mistake." What would be an alternative to "Thanks, my bad!"
alerting is a good choice when you're trying not to sound too formal or too informal.
And thanks is also informal.
My bad means "sorry, that was my fault". Only if your mistake has harmed others ("harm" very broadly construed) would you use that phrase. For example, when a football player makes an error, such as by passing the ball out of reach of a teammate who might have scored had the pass been accurate, the player might say "my bad". It's a curt acknowledgement that it was you who goofed, that it was not the other person's fault.
The other answer by @Tᴚoɯɐuo is correct.
An alternative would be to identify what the other person's action has done for you, rather than acknowledging your mistake. You could say:
Thank you. That is very helpful.
Note how that acts as an approval for the person to identify similar mistakes is the future. You may want that with, for example, a peer at work. People are reluctant to point out others mistakes too often. They don't want to appear to be nagging. This would convey a message you are happy to be mentored.