What is responsible for this db-sync 'finalizer failure' message?

I noticed while debuging a custom function a while ago that every time my Org-roam database is synchronized, the following message gets printed to my messages buffer:

finalizer failed: (wrong-type-argument sqlitep nil)

As I was exploring the Org-roam database parameters lately, I stumbled upon the org-roam-db--connection variable, and noticed the last path to my local database was the only one using the ~ notation, since it is right after <finalizer> I thought I had the culprit.

#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data
        ("/home/USER/.local/share/org/" #s(emacsql-sqlite-builtin-connection #<sqlite db=0x64432f287950 name=/home/USER/.emacs.d/.local/cache/org-roam.db> nil #<finalizer> "~/.emacs.d/.local/cache/org-roam.db")))

I thought it was odd, because I have not customized the org-roam-db-location variable. Anyway, I decided to set it from my config using (expand-file-name "~/.emacs.d/.local/cache/org-roam.db").

Changes took effect, but the message is still there after calling org-roam-db-sync. It has no side effect that I could tell so far, but no one likes stuff to fail in their Emacs, so I thought I’d ask around.

Thanks for your time.

What’s the value of your org-roam-database-connector? If it’s not “sqlite-builtin” and Doom Emacs lets you, I suggest you try the built-in SQLite. Does this make sense to you?

Thanks for replying.
The value for that variable is indeed sqlite-builtin

Just to make sure that part is clear, it is as far as I know only a failure message printed; apart from that, everything seems to be working fine…
I would not even know about it if it was not for some unrelated debugging I did recently…

Do you consider trying to move Doom out of the equation by removing it? I don’t use it and don’t have the message.

When you say ‘move Doom out of the equation’, you mean for testing ?
I would not actually know how to do that and still ensure org-roam loads. That would require some minimal config if only to get the files locations right I guess.

I actually have no idea how to do this …

Please provide the full error stack if possible

Thanks.

I am seeing this as well with org-roam-database-connector set to “sqlite-builtin”, Doom Emacs, Emacs 29.4 and org-roam 2.2.2.

There is no backtrace shown if (toggle-debug-on-error) is enabled.

@akashp , @fleimgruber has beat me to the punch, after testing with debug-on-error enabled, there is no debugger triggered for me either.

Unfortunately without knowing from where the error is coming from it will be extremely difficult to solve it.

The common thread that connects both of you is that both of you are using doom Emacs. I use vanilla Emacs and don’t have this issue…

Would it be possible to zone in on the issue from your side, Figure out what is failing?

As a first step can you try changing the sqlite connector as an experiment?

Ok, what would be a valid alternative to sqlite-builtin ?

See documentation.
Try emacs-sqlite. It will compile if not available.