Keep in mind that this guide is for the 'main' Pokémon 3DS save type, regardless if it's played on emulator or imported using save manager.
In the images below, Citra was used simply as a convenient way to show screenshots, do not be misled by it!
You load the game and it tells you it's corrupted, however PKHeX is able to load the save.
What you should do:
1. Check the folder you import the save from. Your file in the folder MUST be named main
(note how my file is called main1? That's the mistake.)
2. main MUST be the only file in that folder.
There cannot be other files in the same folder you import from, such as main.bak etc.
3. (Citra only) Also do not rename the folders that contain the main. The wonky numbers generated by Citra are the correct folder names. Changing them will screw it up.
Scenario 2: Game says save is corrupted, and PKHeX is unable to load the save.
Chances are, your dumped save file is indeed corrupted.
Maybe there was an error with dumping the save -> redump the save, provided that you’re able to continue the game and it launches on your console.
Perhaps there was an error when transferring save to PC via FTP -> if you were using FileZilla, change the setting to use binary transfer mode instead of ascii.
If the steps above were not able to resolve the problem, load up an older copy of your save. Also make sure you're using latest version of PKHeX.
Oh, ALWAYS keep a safe backup of your save in a completely differently folder, especially before any edits or transfers etc, so that if any corruptions occur, you always have a backup to revert to.
Instances of people mucking up Notable case studies:
Filezilla needing Binary Transfer Mode instead
Game displays save as corrupted, cause it wasn't named correctly
PKHeX won't read the save, as it is empty
Changing names of Citra Folders messed up the save recognition