Musescore 4 Corrupted file

• Sep 8, 2024 - 13:54

Okay, so... I saved all my work before exiting the file, closed my laptop, then opened it a few hours later to work on my piece and I'm met with an error message that reads "File '...mscz' is corrupted. This file contains errors that could cause MuseScore to malfunction."
I chose the option to open it anyway and it turns out to just be a blank canvas with no notes, bars or measures. My computer has been playing up recently, but I thought that saving it would prevent me from loosing it.
I tried opening it in Musescore 3 but I don't think I did it right because it wouldn't allow me to.

Does anyone know what actually happened and how it can be fixed? Your help would be so much appreciated.

Attachment Size
I'll Be There Waiting.mscz 48.88 KB

Comments

This file is corrupted beyond repair.
Musescore saves backup files in a hidden .mscbackup folder, which is located in the same place as your project file.

There should be a file named .name_of_your_file.mscz~
where "name_of_your_file" is the name of your project file.
Copy it to another location, remove the ~ from the file name and try to open it.

Did you close your laptop with MuseScore open? This can cause problems in general. Maybe not with this score.

In reply to by bobjp

Closing the lid while the file is still open but already saved is very unlikely to cause this. MuseScore does not write anything to disk unless you tell it to (or when AutoSave tells it to, but that will never affect the real file). So there is almost no chance that MuseScore writes a corrupted file while the lid is closed, because it doesn't write anything at that moment.

This is just another case of the dreaded completely inexplicable corruptions that happen a few times per month but nobody knows what's causing them. So far all known cases of this were on Windows, so I assume you are using Windows too?

It may still be useful if you could upload the backup file, but you'll have to upload the version without the ~ in the name for the site to allow it.

In reply to by cbjeukendrup

I just switched to using Musescore on Mac, from Finale (may they rot in....) it has been great, good transfer in to MXL....until I started to work on the last movement of a piano concerto today.....and getting the "file is corrupted" warning.......Can't anyone in Musescore figure out hoe to fix this? Losing this last movement will be real crusher! I could use some help.....and it is quite clear I m not alone in this!

In reply to by Josephel Padraig

It would be good to know that there are two different problems:

  • There is a completely mysterious problem that causes scores to be corrupted irreversibly, i.e. the entire content is lost. Because it's completely indeterministic, we cannot investigate it because we have never been able to reproduce it ourselves. It is likely that it is a Windows bug or a Qt bug, rather than a MuseScore bug.
  • Sometimes, the content is still there, but some logic error creeps into it. This is in theory deterministic, but since such corruptions are often the result of complex edits and only become apparent at the end of an editing session, so it is difficult to find out what exactly is causing the corruption. However, fortunately such errors are hardly ever catastrophic, as they are usually easy to fix. As already said, we'll need a copy of the score file to be able to give you any further advice.

In reply to by cbjeukendrup

Can we add a check after the save to verify the file? And if we discover that the saved file is not a valid zip file, to alert the user with a proper message and ensure: 1) there is a backup of the file and 2) we have saved the current score in its unzipped form somewhere (could be a problem during the zipping phase?).

In reply to by krasko78

I'm thinking of something similar (re. verify-after-save): after saving, we would do a quick check if the main score file can be extracted from the generated ZIP file, and whether that can be read by an XML parser. If that fails, then display an error message, telling the user to try again (because my hypothesis is that that will most likely fix it).

MuseScore generates the ZIP file directly, so the files are not written to disk in an unzipped form at any point. The resulting file is first written to a temporary file, with _saving added to the filename; and then moved to the definitive location (so the old file is not overwritten when MuseScore detects an error during saving). The problem is that this corruption error is not detected during saving.

It's unclear whether this happens in the memory during the zipping phase, or while writing to disk, or while moving the temporary file to the definitive location. We could decide doing even two checks: first check the temporary file before moving it to the definitive location, then check the definitive file too after it has been moved.

In reply to by cbjeukendrup

Absolutely. I've already started implementing this and was going to open an issue on Git and post my changes. In fact I have it mostly done (double check - before and after the move) and have been even able to test it. I have yet to come up with the dialogs to show if a corruption happens. I am thinking of a series of simple dialogs, like a wizard, to walk the user through this. Of course this is a rough initial idea that can be refined later during the review and conversations. I am going out for a piano class now and will create the issue on GitHub as soon as I come back. :)

In reply to by krasko78

I think a series of dialogs would be too much; just one of them should be enough. I think all we need to convey is:
- An error occurred while saving your file
- This may be a one-off error; retrying often fixes it
- If it keeps happening, try saving the file to a different location or to MuseScore.com
- (if it occurred pre-move) The version of the file that was on your hard disk is intact, but please retry saving in order not to lose your latest changes
- (otherwise) Please retry saving the file in order not to lose it

(and of course, some special cases are needed for never-saved-yet files and cloud scores)

But let's continue the discussion on GH.

In reply to by cbjeukendrup

Whilst such verification would be welcome, it is still not a good idea to "keep all your eggs in one basket". What if this verified file gets corrupted by a glitch next time you boot the computer, or next time you start MuseScore? It really is simple and worthwhile implementing file versioning for important files.

Microsoft Onedrive has file versioning built-in so using a Onedrive folder for your scores can be a good idea if you don't want a manual method. Maybe other cloud storage services also do this.

Even better, what if MS offered a score versioning option as well as verification?

In reply to by yonah_ag

> What if this verified file gets corrupted by a glitch next time you boot the computer

This kind of stuff is out of scope for MuseScore (and thus for this forum). Preventing data loss as the result of such events by making regular backups is the own responsibility of every owner of a computer.

> or next time you start MuseScore?

Reading a file cannot cause its content to be changed, unless you have a severely broken hard drive or file system.

> Even better, what if MS offered a score versioning option as well as verification?

A versioning feature is offered by MuseScore.com.

Do you still have an unanswered question? Please log in first to post your question.