SQLITE_CORRUPT: malformed database schema - out of nowhere

Hello, I have been working all week on my database, and everything was fine last night. This morning I have tried to start working on it and when I tried merging images, this has come up out of nowhere:

" SQLITE_CORRUPT: malformed database schema (http://www.w3.org/2001/XMLSchema#string)"

The first time around it said something about my project (“project title”.tpy) having been moved to the recycling bin in OneDrive and that I had 30 days to restore them. I had not moved anything to the recycling bin, but for some reason it was there. I clicked restore, quit and restarted Tropy but my project still comes up with this error. Now I have tried moving the project file from OneDrive to my Desktop to see if that helps but it still will not open.

Please can you help me to restore my files as it seems I have lost loads of work for absolutely no reason? I am quite annoyed about this. Who can I speak to?

Did you restore the file via OneDrive while it was open in Tropy? It sounds like OneDrive restored or somehow wrote to the file while it was used by Tropy – or in any case that there is an issue with the way OneDrive restored the file. Can you restore an older version of the file via OneDrive? It sounds like that would be the best solution. Otherwise we can take a look at the file to see if it can be repaired.

For context, if a project file is ever corrupted by regular access via the SQLite API there are normally only minor issues with the file that, in my experience, can be always be solved. However, I don’t know what OneDrive actually did in this case and so I can’t speak to that.

Hi, I restored the file in OneDrive while the error message was showing on Tropy. I don’t know whether that means the project was open on Tropy or not. I thought if I clicked dismiss on the error or quit Tropy there was a chance the project would be deleted. After I restored it I quit Tropy and tried opening it again and it didn’t work. I have now moved the file from OneDrive to Desktop in case there was a problem with the cloud, but that hasn’t helped. What is the next step? How would I send the file to you? Thanks

Tropy continuously writes to the project file as you make changes and also when you close the project. If OneDrive restores the file in the middle of this (i.e. also writes something to it) it’s very likely that the file will be corrupted. At this point moving the file out of OneDrive doesn’t help since the file is already broken – the question is if you can restore an old version of the file (from before this happened)? If you can do that, this version is probably just fine and should contain all changes made up to that moment.

Otherwise, if the file is not too big, you can send it to me by attaching it to a direct message here on forums. If the file is too big, you can send me a link instead (if you share it via OneDrive for example).

Hi, I clicked restore on older versions of the file but nothing seemed to change.
I have tried to attach it here. Does this work?

This is an attachment of the file I moved to my Desktop
Arisa DPhil.tpy (10.5 MB)

This is a OneDrive link to the file I tried to restore on OneDrive
Arisa DPhil.tpy-journal

Do either of these have a chance of recovery?

Thanks a lot

Oh, the restored file is actually the journal file. This is a temporary file that will get created while Tropy is writing to the project file. Removing a journal file while it’s in use is actually one of the ways that can lead to db corruption, so I think this is what happened here.

I briefly looked at the project file and there is definitely some hope in recovering your data. Recovering the data will involve some work for me but then you’ll also have to review everything to check that the data is complete (on first glance I would suspect that we can probably recover everything up to the point where the corruption happened but it’s hard to tell with no knowledge of the data). What I’m trying to say is that this will take some effort for both of us, so I’d just ask you to confirm that you definitely can’t recover an older backup from OneDrive, because that would be the quickest solution.

Hi there, thank you so much for your help. I really appreciate it. I went back onto OneDrive and the only file on there I’m able to find is the journal file, and all versions I try to restore are also journal files - so the proper file must be lost somehow?

If you are able to restore the project I would be incredibly grateful.

If I do get the project back, how do I ensure that this does not happen again and my project is kept safe? Where is the best place to save the file? I am quite nervous about continuing to put work into the file if there is a risk of losing it again so easily!

Hi, is there any update on this? Would you be able to provide some help? Thanks a lot in advance

Sorry, I was away for the last couple of days. I started to recover your project data, unfortunately it is more time consuming than I’d hoped because there is a lot of data which can’t be recovered automatically but is relatively easy to re-associate manually. There are approximately 9,000 photos in 5,500 items in the data that I can see (including deleted items) – that’s what we’ll be able to recover, but I’ll probably won’t have it ready until after the weekend.

Regrading best practices in general, it’s good to backup the .tpy file with a service like OneDrive; to be extra cautious you can also create a manual backup copy from time to time. While you’re working on a project, Tropy will create the -journal files from time to time. These exist only temporarily. It’s OK to back them up as well in OneDrive but it’s never safe to overwrite or delete them (as mentioned they only exist temporarily, so most of the time they should only be there while Tropy is active; if there was a crash for example the file could still stick around but Tropy would use it to recover data the next time the project is opened).

Hi, thank you so much, that’s good to know. I would be happy with whatever you are able to recover. I look forward to getting some more updates from you.
Many thanks for your help,
Arisa

Hi, I’m attaching the reconstructed project file below. After clearing all malformed data this includes 5,442 items (713 are marked as deleted) and 9,058 photos including metadata. The items are sorted into 39 lists. There are no tags or notes. The file was severely damaged so I’m certain that there is some data loss here, but I hope that the recovered file retains most of your work.

Arisa DPhil.tpy (10.3 MB)

Hi there, thank you so much. I tried downloading it and opening it on Tropy, but this sign still comes up.

I’m not exactly sure why this keeps happening or what the solution is?

I’m really grateful that you’ve gone out of your way to help me and I hope I will be able to access it.

Thanks again

Ah, I tried again and it has opened! Thank you that is fantastic!

Is it best to now keep the folder in Downloads? And then put a copy into OneDrive that I regularly back up? Or should I just move the whole file to OneDrive now? Will that ruin the file?

Normally it should be fine to keep this in OneDrive. The file format itself is also very robust – in fact I had not seen a file this badly damaged before over many years. I think in your case it was caused because the temporary -journal file was overwritten.

As a general rule, it’s good practice to make backup copies from time to time. Having the file automatically backed up by OneDrive should be fine as well. Just be careful to not overwrite, restore, or otherwise access the file while it is also open in Tropy.

Hello,
it seems like I have the exact same problem with my files and my Tropy project. Would it be possible to also send you the file (including around 129 files) to recover it?

Thank you so much for your help in advance!

Absolutely, you can send me a link to the .tpy file in a direct message. Only the .tpy file is necessary for this, the image files are not required. We’ll take a look at the file and do our best to recover the data!

Hello, I just encountered the same problem. I didn’t work on my Tropy project for a few months, the .tpy file is stored on my Synology Drive, and when I opened it this morning, I received the same message. I copied the error:
{“msg”:“SQLITE_CORRUPT: database disk image is malformed”,“stack”:“Error: SQLITE_CORRUPT: database disk image is malformed”,“system”:“Windows_NT 10.0.19045 (x64)”,“time”:1698228972043,“version”:“1.15.2”}
Can I also ask for you help and send you the .tpy file? Thanks a lot in advance…

Sure, you can send me the file and we’ll take a look!

Hi there,

I am also experiencing this issue, would I be able to send you the .tpy file? Thanks in advance!