Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error initialising the database #5

Closed
adamshand opened this issue Jul 25, 2023 · 15 comments
Closed

Error initialising the database #5

adamshand opened this issue Jul 25, 2023 · 15 comments

Comments

@adamshand
Copy link

Hi,

I've been using the Prompta macOS application for a few days and really liking it, thanks!

Yesterday I pasted in a good chunk of JS error message trying to solve a problem and Prompta crashed. Since then, opening Prompta app has resulted in the below error message:

There was an error initializing the database. Please try again. If the problem persists, please report in on GitHub.sqlite3_open_v2.

image

Deleting ~/Library/WebKit/com.prompta.dev got rid of the error message, but Prompta still hangs forever on opening.

Deleting ~/Library/Caches/com.prompta.dev and I had to enter my API key again but everything is working.

@iansinnott
Copy link
Owner

Hey @adamshand , I'm seeing the same error although only in the PWA-installed version. I'm guessing you're getting this directly in the browser?

@iansinnott
Copy link
Owner

eh, sorry, i see you're using the installed macos version. latest version?

@adamshand
Copy link
Author

Yes, I believe it's the latest version: Version 1.1.0 (20230717.161342)

@adamshand
Copy link
Author

adamshand commented Jul 27, 2023

Just had it happen again when pasting JS code. If it happens again., I'll try and grab the content that seemed to cause it.

@adamshand
Copy link
Author

adamshand commented Jul 27, 2023

Just got it again on the web interface at chat.prompta.dev (5:37pm NZT if you want to look at logs). Not JS code this time, just text.

image

@iansinnott
Copy link
Owner

iansinnott commented Jul 27, 2023 via email

@iansinnott
Copy link
Owner

ah i see. responded from email which didn't have the image

@iansinnott
Copy link
Owner

I'm still not able to repro this. Tried in incognito Brave and the app seems to be working. There's definitely an issue, as i've seen it before too, but i don't currently have a way to reproduce the issue.

any thoughts? it seems like you're running into this fairly often?

@iansinnott
Copy link
Owner

I upgraded the database dependencies. This is where the wasm version of sqlite we use comes from.

Not that this will resolve the problem, but you could try the latest version and see if it's any different: https://github.com/iansinnott/prompta/releases/tag/v1.1.1

@adamshand
Copy link
Author

Will upgrade and see how it goes, thanks!

No idea on reproducibility, seems pretty random, but often as chat logs get longer. Could it have something to do with tokens running out?

If I spot a pattern or can reliably reproduce, will let you know!

@jdahlborg
Copy link
Contributor

Hello,

I encountered the following error just before the above mentioned problem while using the application:

sqlite-api.js:866 Uncaught (in promise) Error: database disk image is malformed
at check (sqlite-api.js:866:11)
at Object.step (sqlite-api.js:699:14)
at async _TX.statements (TX.ts:152:17)
check @ sqlite-api.js:866
(anonymous) @ sqlite-api.js:699
await in (anonymous) (async)
submit_handler_1 @ +page.svelte:332

This issue has happened multiple times but unfortunately I'm unable to reproduce it. I'll also try to spot a pattern!
I'm using chrome directly. Not PWA.

@iansinnott
Copy link
Owner

In a separate project I ran into a similar issue, which lead me to this: vlcn-io/js#31

Prompta uses wa-sqlite with fts5 or search and persistence.

@rhashimoto
Copy link

@iansinnott I think there are two different problems in this thread. The one with the stack trace and "Error: database disk image is malformed" could indeed be vlcn-io/js#31 for which the underlying problems in wa-sqlite and SQLite were recently fixed.

The one that just says "sqlite3_open_v2" doesn't match up with the above bug. There is no known wa-sqlite problem that fails within sqlite3_open_v2() like that. When this occurs, it would be helpful to check the browser Dev Tools JavaScript console for error messages.

@iansinnott
Copy link
Owner

Thanks for chiming in @rhashimoto. These may indeed be separate bugs, but when i've seen this pop up in the past they seem correlated. It usually goes like:

  1. Disk image malformed error
  2. (I restart the app)
  3. open_v2 error, assumedly due to malformed database

The app code has not done a good job of surfacing full stack traces for users to post though, so I'm speculating. Looking forward to your recent fix getting merged into vlcn

@iansinnott
Copy link
Owner

Anecdotally, I replaced the use of FTS5 with LIKE '%query%' in another app where I'm using vlcn, and so far have had zero issues. When using FTS5 the database would become malformed usually within hours of resetting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants