V2, .dir-locals.el, read-only databases and accidental slashes

I’ve been testing out switching to v2, and ran into troublesome issues. I resolved the problem, but I’ll record it here in case someone else runs into the same issue. Symptoms were:

  • Running (org-roam-setup) displays “Processing modified files…” and restarts when it gets to around 25%
  • Letting Emacs continue will eat up all the memory until it locks up the system
  • I attempting to debug I would see messages about “read-only database” failures

What eventually revealed the root problem was when I output (ht->alist org-roam-db--connection). It showed that I had multiple connections for the same org-roam directories. One had a slash and the other didn’t. I use .dir-locals.el to set org-roam-directory so that I would be able to have multiple directories. However, I also set org-roam-directory so that there is a default org-roam directory that would be accessible from any non-org-roam directory.

The problem was that the local dir path and the default dir path, although they are same directory, were not exactly the same due to a slash ending on one but not the other. If you run into this problem, you can use file-name-as-directory to ensure that all locations have the terminating slash.

2 Likes