Glyphspackage file corrupted, but where?

The document “mydoc.glyphspackage” could not be opened. Problem with file at line 145. Reading: GSLayer

I have been an idiot and must have messed up a merge yesterday. Now I cannot open the glyphspackage file anymore. I know that it must occur in one .glyph file, but I don’t know which. I have gone through a lot of .glyph files to see what is written at line 145, and just out of guesswork, I rolled back files that had a line starting with layerID=“xx”, but with no success so far (quite a few left to go).

My question is, is there a way to get a more specific description of the problem? I would very much like to find out myself. Thank you!

I found the culprit (deleted files in the /glyphs/ folder until it worked again, then narrowed it down). Just for reference, this is the merge that somehow screwed things up. I can’t quite see why (left: old, right: new):

The extra closing curly brace } looks dangerous.

Oops, well spotted! Thank you.

Is there any other way to spot the specific erroneous file without having to go through everything like I did?

Run a plist validator over all files.

I’ll need to improve the error messages to include the file name for packages.

That would be a great help, thank you. Does a plist validator work for .glyph files? :thinking:

Yes, .glyphs files (and fontinfo.plist, order.plist, and the .glyph files inside the glyphs directory) are property list files and can be validated for example using the plutil command:

$ plutil 'Some Font.glyphspackage/glyphs/a.glyph'
Some Font.glyphspackage/glyphs/a.glyph OK

Or validate multiple files with

$ cd 'Some Font.glyphspacke/glyphs'
$ plutil *.glyph