@Tolriq has already answered how to handle the problematic files, (usually it means re-ripping or re-downloading the song in question). If neither is an option and you want to get rid of the error message by removing the problematic frames, you can use this command if you have flac.exe on your PATH:
flac --best --verify --force --padding=4096 --silent *.flac
replacing *.flac with the name of the problematic song, otherwise all songs in the current directory are recompressed.
That does NOT fix the error tho, the broken parts will simply be removed, which is why I don’t recommend doing it.
Concerning the first part of your question, you can use my new python script, flacr to recursively test your files for decoding errors if you want.
I’ve fixed it up over the last couple of days (I don’t care about progress bars for example but usually people expect to see something other than a blank line when running a script).
flacr.py -tpl -m 8 -g 300000 -d "D:\Music"
This command would recursively scan the D:\Music directory, collect all flac files, decode each one of them with flac.exe using 8 threads, log decoding errors to flacr.log and display a progress bar while doing so.
The -g 300000 part assumes your library size is a bit below 300k files. That’s only used to improve the accuracy of the progress bar while the script is still busy looping over the directories. If you don’t set it it defaults to 999999, it’s just a cosmetic thing.
The script can do more, just use -h or read the readme on github if you’re interested, but that command should cover your use case.
Do let me know if you run into errors, the script in its current form is brand new. Cheers.
PS:
I’ve only tested it on windows, if you or someone else tries it on another OS, let me know if it works.