Do you have "missingno" in Pokemon Sword?
You know, the glitchmon that allow you to duplicate pokemons. The one with a black pokeball sprite.
If yes, delete it. Or if you can't, place it in the team or nursery.
That same crash happens if you have glitchmon on Sword boxes, I don't know if this is the case, just checking.
Anyway, you can also try to create a new profile on the switch, start a new game on sword and depositate all the pokemon on home in that save file, then try again to transfer between the old save file