I have a rear rack on a bike. Eventually, one of the bolts that connect the rack support to the seat tube fell away. When I looked at the whole, expecting to see threading for a bolt, there was just a hole, a bit bigger than I expected.
I took it to a guru who said, Yep you need a RivNut. Click here for Park's view. A RivNut is a rivet that you put into a hole on a bike frame, and when you tighten and deform the rivet, you end up with a smaller threaded hole you can put a bike bolt into.