.MSCZ file corruption

• Jan 15, 2023 - 13:08
Reported version
S2 - Critical

I dont know how it happned but here is what i did:
1.) I had worked on a score and was finished for the day so i save the score and closed musescore, and nothing special happned.
2.) I shut down my computer and went to bed
3.) I woke up and turned on my computer(No error poped up at startup or shutdown)
4.) I went to musescore and tyred to open the file, i noticed that it did not have a "screen shot" of the score, but i did not think much about it and i tried to open the score but i just got an error that said as following: "Open error
File "C:\Users*********\Documents\Musescore4\Scores\KONZERT_gdur.mscz" is corrupted." and when i checked the file size in the file explorer (Explorer.exe, btw i am using Windows 10) it was 0 bytes

I hope that this bugreport can help you find out what happned so that it does not happen to other users


Severity S2 - Critical S3 - Major

Unfortunately, this kind of corruption where the file suddenly becomes 0KB is still a riddle to us. It happens sporadically (also happened in MS3), and there is never a clear reason nor a way to reproduce it... very unfortunate.

You could try to recover the file; in the same folder where the file was saved, there should be a folder called .mscbackup, and inside that folder there should be a copy of the file from before the last time you saved it.

Just so you know, i am currently looking in the source code so that i can potentially find where the bug is located

Looking in the source code lena35?

I wish you best of luck.

I'm no programmer, but nevertheless; Here some information for general people who wonder why corruption can be such a difficult matter to remove: The score lives in a database, so every action the user does is reflected in a read and/or write access to the database. Thus possible sources of .mscz file corruption can be errors in the undo/redo queue actions, errors in the translation of the user's actions to database access commands, errors in the database's own code and errors in writing/reading of the database content into/from the .mscz file.

@talshiar MuseScore doesn't use a database structure. Also, only when you press "Save", the score is written from the working memory to a file (there is no continuous communication with the score file on the disk, as you suggest, which would make the app very slow).

So, this specific corruption happens specifically while saving the file. Since it is the ZIP file that is corrupted (rather than its content), it is very unlikely that this has to do with any prior actions from the user.

Interesting source files are mscwriter.cpp, zipwriter.cpp and zipcontainer.cpp.

I didn't look at the code, just Imagined how the program could work. So let's call it internal representation of the score and not a database :), but I accept that the concepts are different. Otherwise, I must have been imprecise, I didn't mean to imply the database were a disk file.

You both probably already know this: The 0-files happen with other windows programs too, and this is discussed in many net pages with reasons and solutions.