As noted above, some thread locker (removable, usually blue color). If you do not have any and do not want to bother getting any, try some grease.
On my Thorns that have a tab on the fork for a bottle generator, I carry spare M5 bolts, one rack or fender type bolt and one countersunk for my bike shoe cleats.