In game, when you fail a legendary raid, the scientist at the entrance would ask you if you wanna note it down. With that, you can redo that legendary.
in PKHeX, it’s somewhere in the block editor, with a somewhat readable name. If I was at my com I’ll give it to you, but for now we just have that