Any idea how I can fix this or what might have caused this to happen? I tried fixing this by opening the file in Sublime Text, but line 191210 doesn’t exist lol. I’m working with KiCad V5.1.2 on OSX.
There should be backup files in the project directory. Maybe use a diff tool to compare the pcb file backup with the normal file. Or possibly even overwrite the damaged file with the backup. (If you choose the latter then definitely make a backup of the damaged file should the backup file also be damaged.)
Did you try to rename the backup file (remove the -bak suffix)? Maybe these messages are because kicad tries to use the wrong parster for it if it is not named like the normal parser expects it to be named (stab in the dark as i have no knowledge about these details.)
There’s no guarantee (by KiCad) that external tool create valid files. it’s probably a bug in the script which creates the footprint. But IMO KiCad shouldn’t just crash when opening such files, it may be a bug in KiCad, too.