There's no way to repair it if the system does not recognize it, as any repair utility needs to be able to access it.

Flash drives/Pen drives are best thrown away when they start acting weird.
Just buy a new one and never put any important data on it unless that data is backed up on another drive.