"Duplicate IDs in file" error

Hello,

I am syncing my org-roam files between two computers with Nextcloud. In one computer, I execute org-roam-db-build-cache and it seems to work right but in the other computer I get a bunch of “Duplicate IDs in file.org” error, for example:

Error (org-roam): Duplicate IDs in /home/user/Nextcloud/Apps/org/notes/emacs.org, one of:

92b14ab3-8af6-4e5d-9370-63ba34603fa1
ae0b3645-13d4-4443-997d-18d20af68795
  • Is this an important error?
  • How can i solve it?
  • Any tip to avoid having this error again?

Thanks!

Christian

1 Like

I solved deleting the org-roam.db file (I saved it just in case) and executing org-roam-db-build-cache.

Not sure this is causing your issue, but in case you are not doing it: you should exclude the org-roam.db file from the sync.

I thought it would be better to sync the org-roam.db file… is it automatically re-generated in every boot of emacs? If I use emacs daemon in a PC running for days, should I run org-roam-db-build-cache to update the database file from changes from the another PC that have been synced?

Although it is not exactly org-roam, should I sync orgidfile?

Subsequent rebuilds are cheap. You should keep the db out of sync, because the SQL connections create a read/write lock.

Does this mean that while creating new notes the db is not updated? When is it updated? And how should you implement it?

No, he is saying that you should keep it out of your dropbox/googledrive/onedrive/syncthing/git folder. Keep it somewhere that is just local to a single machine.

The expensive build is done once when you activate org-roam the first time (when you install it), and the database is updated incrementally whenever you save a file.

I see. Thanks!

I have my db file locally on my machine (not syncing with anything).
In my case, the problem occurred when I was creating a note, and my emacs was lagging. I had to abort using C-g. Then I created the note again, and got the “duplicate id” error.

I solved it (I think) by doing what was suggested above:

1 Like