Error loading board parse_error

I have error like this picture how to fix it. I can’t open a pcb file

Well your pcb file seems to be corrupted.
Have you changed it outside of kicad?

Without the file we will not be able to help you.

Does your project live in some sort of version control or do you have some other form of backup (if neither of this is true maybe now would be the time to think about using it for later projects.)
If so does your previous commit open.

maybe the kicad_pcb.bak file is still ok. (You will use data when doing this!!)
I would suggest you do the following:

  • close kicad
  • make a backup of the project folder. (copy everything!!)
  • delete *.kicad_pcb file and rename *.kicad_pcb-bak to *.kicad_pcb
  • open your project and hope it works.
  • if this doesn’t work you still have the backup from step 2. (only option left: try to repair the file with a text editor.)
1 Like

I didnt changed it outside of kicad.
thanks i will try.

This type of error message may occur when PCB file was opened and saved by text editor with bad UTF-8 support, Windows Notepad for example. The KiCad project files uses UTF-8 coding. Many editors uses UTF-8 but add invisible BOM (Byte Order Mark) on the beginning of file while save. KiCad parser does not recognize BOM marks and display this error.
If you did not fix your file with other method, use any plain text editor which can convert and save file with UTF-8 (without BOM) coding, for example Notepad++.

1 Like

I got a similar error when reading a PCB file on Linux that was written on Windows. Nothing but Pcbnew (downloaded and installed this evenning) on Windows (V7-AMD64) had touched that file, except that it had been copied over to a Linux machine. The message:

Error loading board.
PARSE_ERROR: Expecting 'number' in input/source "/home/john/projects/teletype/hardware/oscboard/osctest01.kicad_pcb", line 72, offset 23
from /build/buildd/kicad-0.20131208+bzr4024/common/dsnlexer.cpp : Expecting() : line 285

The bad line in the file reads

(layerselection 0x00030_80000001) 

which, sure enough, isn’t a good number. This looks like some 32/64 bit problem. Both the Windows and Linux machines are 64-bit. The documentation for the file format (at https://kicad.org/help/file-formats/) shows this item as being part of “pcbplotparams”, but there’s no explanation of what the value means. There’s an example in the documentation:

(layerselection 3178497)

Not too helpful, except that value is equivalent to 0x308001.

So I tried editing the .pcb file, first using a value of 0x308001. That produces the same errror. The lexer doesn’t like a hex value there. Then i tried 3178497. Now the file will load and display, although the layer visibility is wrong - the PCB board substrate has disappeared.

So that’s what’s going on - the Windows version is writing hex where the Linux version expects decimal. Don’t know why.

Tried to upload the .pcb file, but “new users can’t upload attachments”.

Just upgraded the Linux machine to the latest stable release:

Application: kicad
Version: 4.0.4+e1-6308~48~ubuntu14.04.1-stable release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.4,wx containers,compatible with 2.8)
Platform: Linux 3.13.0-95-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_WXPYTHON=ON
USE_FP_LIB_TABLE=HARD_CODED_ON
BUILD_GITHUB_PLUGIN=ON

Now it works, even with the hex value in layerselection. This is some kind of version incompatibility bug.

Yes, the file format changed without changing the version number, sadly Kicad devs do this often. The number of layers was extended from 16 to 32, so the variable changed from 32 to 64 bit. I’m not sure why they also needed to introduce a new weird hex representation.

To avoid any incompatibility problems make sure you have exactly the same KiCad version on each system.

That’s two years older than 4.0.0 so plenty of code drift

“To avoid any incompatibility problems make sure you have exactly the same KiCad version on each system.”

Is it really that bad? Or is it only backwards compatibility that’s broken?

Generally, I find going forwards is OK, backwards is unreliable.

However, there is at least one known bug where old boards can’t be read by newer KiCads. There is simply no guarantee that sort of thing won’t happen again, and maybe in a way that messes up your project without you realising. I find the rescue feature dodgy, it often tries to “rescue” schematics incorrectly.

So I stand by my advice, to ensure compatibility use the same versions. Expect to find problems proportional to the difference in version number.

4.0.4 is the latest stable release (see how quickly it changes :slight_smile: )

4.0.0 through to 4.0.4 should be 100% compatible as the changes are only bug fixes and why the desirable new features like rounded rectangle pads have not been included