KiCad Layout File Corrupted

Hi, I tried to move a custom made silkscreen graphic footprint I made using this tool: http://img2mod.wayneandlayne.com/

KiCad crashed during this process, and when I tried to reopen the file, I got this error message:

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.)

1 Like

If the line number does not exist, this is a bug. Please report it after you upgrade to 5.1.4 to check and see if it hasn’t been addressed already.

Okay I tried to open the .kicad_pcb-bak file with pcb new but it also throws an error:

This time the line in question does exist, it’s the very last line of the file, which contains the text “)”

Does that clarify anything?

Actually, it gets much weirder:

Apparently KiCad is missing a ‘=’ at every single line of the file, 1-481346. Any idea what is going on here?

This all happened just as I was about to commit a bunch of work to git, so if there’s a better solution than redoing everything that would be awesome.

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.

Depending on what graphics you have, you can even import SVG’s now, although it is experimental and needs to enabled by a hidden config file.

I think you need to put the kicad_advanced in ~/Library/Preferences/kicad

Content example:

EnableSvgImport=1

Documented on http://docs.kicad.org/doxygen/namespaceAC__KEYS.html

I would like to know if it works on macOS builds or not.

On a side note, any reason not ot use 5.1.4?

Thanks this worked for me! Backup is pretty close to where I was at so I was able to keep most of my progress.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.