G4: Error on export "the font contains glyphs with duplicate production names..."

Screenshot 2026-09-25 at 12.43.18

Basically, it’s glyphs that were at some points renamed.
L.ss02, L.swsh (both were L.001 at some point)
e.ss03, e.ss04 (that was renamed from e.ss03 to e.ss04)
etc.

The only way I’ve found to fix this is to rename L.swsh, e.ss04 to L.005 and e.005 (never existed), then mark them as non-exporting glyphs, then create new glyphs L.swsh and e.ss04 (from scratch, without duplicating anything) and placed the renamed *.005 glyphs as components.
But I’ve got dozens of this kind of glyphs, doing it manually hurts. Unfortunate thing is that Glyphs gives this error but not listing all affected glyphs at once. I only find out about “another one” after the listed one is fixed.

Run the following script in the Scripting Window (Macro Panel); it will list all glyphs with conflicting production names:

from collections import defaultdict

productionNames = defaultdict(list)

for glyph in Font.glyphs:
    productionName = glyph.productionName
    
    if not productionName:
        productionName = Glyphs.productionGlyphName(glyph.name, Font)
    
    if not productionName:
        productionName = glyph.name
    
    productionNames[productionName].append(glyph.name)

duplicates = {
    productionName: glyphNames
    for productionName, glyphNames in productionNames.items()
    if len(glyphNames) > 1
}

if duplicates:
    for productionName in sorted(duplicates):
        print(f"{productionName}: {', '.join(duplicates[productionName])}")
else:
    print("no duplicate production names")
1 Like

Thank you, Florian. At this point I’ve done the annoying part by hand but will definitely use this script in the future if the problem repeats.