1

I have a couple of months' work on a project in QGIS 3.16.13 with Win 10. All my data is stored on a flashdrive.

Since yesterday when I try to open my project I receive this error message

Cannot read unzipped qgs project file

enter image description here

I also cant open my QGZ file with a text editor. When I try to unzip it I get a CRC-Error, with "tag-mismatch". I also cannot repair my archive with 7-Zip or winrar.

How can I repair my QGZ?

2

1 Answer 1

2

As you are clearly suspecting, your zipped .qgz has become corrupt on the flashdrive.

If you don't have good (ideally nonflash) backups, as a first step, trawl $USERPROFILE\AppData\Local\Temp (note AppData itself is hidden) on the computer you have QGIS on with an undelete program, if you have one. QGIS will have temporarily stored the unzipped .qgs in a randomly named subdirectory there while saving the project and then deleted it afterwards. If you are really lucky, you'll be able to find it. Note Windows Recycle Bin does not store stuff deleted from AppData\Temp so you'll need something else that really goes low-level.

Alternatively, try renaming the .qgz file to .zip before running compressed archive repair utilities. That will give them the hint that it's a zip file, in case the corruption is just a few bytes at the end which is recoverable but won't automatically be recognizable as .zip.

Otherwise, I'm afraid it's rebuild time. Note data changes will reside wherever your data is stored, so those are not lost. But it may take time to rebuild the project, of course. Perhaps symbologies, etc., can be copied over from saved styles (in gpkg for instance, if you ever did that) or from older or forked projects?

As an extreme measure, if you can recover a truncated or corrupt .qgs file from the mangled .qgz, it will just be a XML file. If it is worth your while, you can try to copy over the good bits to replace stuff in a cloned prior version of the project, or in a fresh start. Proceed carefully, one step at a time, and if it's a fresh start, you'll need to make a dictionary of old-to-new layer IDs and manually fix those.

Good luck. I've been there (though not with a flash drive), and you kick yourself for not backing up more often....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.