iansinnott / prompta

ChatGPT UI that is keyboard-centric, mobile friendly, and searchable.
https://chat.prompta.dev
MIT License
153 stars 13 forks source link

Database Error: "Error: database disk image is malformed" #39

Open distalx opened 3 months ago

distalx commented 3 months ago

First of all, thank you for the fantastic work on this project! I've been really enjoying using it and appreciate all the effort that has gone into making it so robust and user-friendly.

However, I've encountered an issue that I hope you can help with. When I enter a prompt, it is successfully sent to the respective model APIs and I do receive a response. The response appears in the chat but unfortunately, it does not get stored in the database.

Additionally, I observe a popover message on the top right corner that says:

Error: database disk image is malformed

Upon checking the developer tools, I see the following error:

Error: database disk image is malformed
SQLiteError — sqlite-api.js:11
check — sqlite-api.js:866

I am currently on the latest commit d1f71cd2e48f0bd941d9c612cd4a57abb1fd6f6e.

I've tried to troubleshoot the issue by following the discussion in iansinnott/prompta#5 and vlcn-io/js#31, but unfortunately, I haven't found a solution yet.

I'm running the project locally, and before attempting more drastic measures, I'd like to know which files I should backup to ensure I don't lose any important data. could you please guide me on what specific files I should backup?

Thank you so much for your help and for maintaining such a great project!

distalx commented 3 months ago

I wanted to share an update on how to back up and restore current chats. Here are the steps I followed:

  1. To back up current chats:

    • Go to settings.
    • Scroll down and click on "Show Advanced."
    • Select "Export All."
  2. To reset the database:

    • Scroll down into options menu and click on Reset Database.
    • Confirm by clicking Yes twice.
    • Restart the app.
  3. To restore the backup:

    • Go to settings.
    • Scroll down and choose "Show Advanced."
    • Click on "Import."
    • Select backup file

However, I've noticed that when I restore the backup, I encounter the same error: database disk image is malformed. This issue might be related to corrupted data. When I start with a clean database, everything works perfectly.

I'll continue to investigate this issue and will post any new findings here.

distalx commented 2 months ago

It seems that the issue has resurfaced intermittently. Unfortunately, I haven't been able to consistently reproduce it yet.

I am reopening this issue to keep track of any further occurrences and gather more information.

iansinnott commented 2 months ago

Yeah, this one is hard to reproduce and thus hard to debug.