Any way to recover a corrupted gds file ?

Hi all,

I am using Klayout 0.26.3 at work.

When I tried to open a recently-completed gds (311 KB), I get this error "XY record expected (position=305244, record number=11690, cell=test)".
I guess the file must have got corrupted when my laptop went to sleep while KLayout was still open.

Can anyone advise if it is worthwhile to try a repair by hex editing or should I redo the gds ?
Unfortunately I am not allowed to share the gds file for inspection.

Thanks !


  • I tried out Glade and Layout Editor, both could open the gds successfully.
    Then saved to gds again, and now Klayout can also open the new gds.
    Problem solved.

  • Evidently klayout likes strict GDS format compatibility even
    in things like byte-counts of fixed format fields. Other tools
    may have some "checking and healing" features that let this
    kind of thing slide, and reformat the output with proper dummy
    / packing on export?

  • Hi wimbur,

    going to sleep should never damage a GDS. The GDS gets saved during "Save", that's it.

    There are ways to damage a GDS, like saving too big polygons (>8k points) without limiting their vertex count (see writer options). Or if your disk is full and the file gets truncated.


Sign In or Register to comment.