I've been using LR/LR Classic for years but in recent months have had two or three instances where I open a catalog to find the dreaded "Catalog file is corrupted" message, and upon telling LR to attempt to repair the catalog, it processes for a while then pops up a dialog telling me that it was unable to repair/recover the catalog.
Some set-up info: I keep my catalog files on external USB 3 hard drives, typically 3 or 4 TB Western Digital "MyBook" devices. I have approximately 30 of these drives filled with photos and only one has ever failed. I am operating under Windows 10 on an older Dell XPS desktop machine. The original image files are also stored on the same USB drive that contains the catalog file -- in fact, this is usually the only content on each drive.
I've run WIndows diagnostics on these drives, and so far, they check out as being OK.
Any suggestions on how to avoid repeats in the future?
This is either a hard disk malfunction (Windows diagnostics sometimes don't catch certain problem and there are more thorough diagnostic tools available) or a problem in the transmission from external drive to computer memory.
Anyway, you need to make sure you have regular and automated backups of your catalog file and all of your photos, and these must be on a different physical disk than the working copy.