I know at least of 3 ways to repair this:
Backups, backups, backups.
I had something similar just yesterday.
I opened an old schematic and had do do some resqueing and porting stuff from V4.0.2 to V5.1.0. (I’m having trouble with focussing and applying Rene’s excellent walkthroughs on this subject) and I’m too short tempered to even remember If I pressed “cancel” or “remap”.
The 2 year old schematic looked OK, but after doing some silly things Eeschema crashed on me (No recollecton of what happened, cannot file a bug report about it this time). When I restarted Eeschema all symols were gone. Just question marks in black boxes. After a check the project-cache had shrunk from 63kB to 611 bytes.
I recovered by extracting an 2 year old project-cache from a backup into the project folder. and after that only a handfull of connecors were missing.
I was easily able to put those back from opening a saved .pdf of the schematic to remember what it looks like.
After that I also opened Pcbnew, and got the names from the Footprins and put them back in the schematic.
Then I tried a netlist export (Or whatever [F8] is called nowadays) but it still had a bunch of errors. I was not able to resolve those anymore, but that was mainly due to my state of mind. It was late in the evening and I had some beers.
If you want to have some meditative fun, then:
1). Draw a complicated PCB.
2). Years later decide the tracks are to narrow.
3). Update the design rules for wider tracks (0.25 to 0.3mm in this case)
… (I wanted 0.35mm, but that did not fit between some through hole connectors)
4). Resolve all the DRC errors, I had som 300 of them.