Error Loading Board with numeric layer name

I tried loading my PCB and gave me an error loading board and left me a blank PCBnew page. What should I do?

I fixed the file for you and re-uploaded. Looks like you found a bug in the PCB file loader, so I’ll see about getting it fixed - thank you!

I don’t think it would have occurred to me to change the layer name to a number - I guess Murphy’s law applies!

Thank you very much, what was the error.

Also, I downloaded it, could you remove the file from the post?

The file is written incorrectly when a layer has a numeric name. Technically, the name is written as an integer rather than as a string, and the parser then rejects it on load because it expects a string. The fix was to manually add quotation marks around the layer name in the layer listing, then load the file and rename the layers.

I’ve filed a bug report in the tracker, number 1667867 if you want to subscribe and follow along. This is pretty critical so I will see if we can get the fix into the 4.0 series, I’m not sure if it’s too late for 4.0.6.

The File Formats spec doesn’t say that a string which is all digits must be quoted. I did wonder how the parser would handle ambiguous tokens, and the answer seems to be “incorrectly”.

The spec is pretty vague in general I suppose. I wonder how many other places this bug could occur?

In general consider the file format to be implementation-defined. There is a spec, but the effort to actually follow it has been…minimal. It’s a guide at best.

Me too. Funny enough I only had to quote the layer name in one place in the file to make the whole thing load, despite every object on that layer also containing the name.

Well, a frequently cited advantage of KiCad is that the data is stored in text files. People then get the idea it should be easy to write external tools to manipulate the files, and a lot of people are.

I was thinking of creating a revised spec sometime.

Hey, I’m not saying it’s a good thing :stuck_out_tongue:

I have changed the thread title as the original did not make any sense with the file removed

1 Like