# "Duplicate IDs in file" error

**URL:** <https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627>\
**Category:** Troubleshooting\
**Created:** [August 12, 2020, 7:10am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627 "2020-08-12T07:10:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrpinedo](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@chrpinedo](https://org-roam.discourse.group/u/chrpinedo)\
**Post date:** [August 12, 2020, 7:10am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/1 "2020-08-12T07:10:28Z")

</div>

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](http://file.org)” error, for example:

```auto
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

---

<div class="post-metadata">

**Author:** ![chrpinedo](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@chrpinedo](https://org-roam.discourse.group/u/chrpinedo)\
**Post date:** [August 12, 2020, 9:13am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/2 "2020-08-12T09:13:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rodelrod](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/rodelrod/32/184_2.png) [@rodelrod](https://org-roam.discourse.group/u/rodelrod)\
**Post date:** [August 12, 2020, 10:13am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/3 "2020-08-12T10:13:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chrpinedo](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@chrpinedo](https://org-roam.discourse.group/u/chrpinedo)\
**Post date:** [August 12, 2020, 10:49am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/4 "2020-08-12T10:49:59Z")

</div>

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 `orgid`file?

---

<div class="post-metadata">

**Author:** ![jethro](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jethro](https://org-roam.discourse.group/u/jethro)\
**Post date:** [August 12, 2020, 11:55am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/5 "2020-08-12T11:55:32Z")

</div>

> [@chrpinedo](#):
>
> I thought it would be better to sync the `org-roam.db` file… is it automatically re-generated in every boot of emacs?

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

---

<div class="post-metadata">

**Author:** ![roi.holtzman](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@roi.holtzman](https://org-roam.discourse.group/u/roi.holtzman)\
**Post date:** [September 16, 2020, 7:31am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/6 "2020-09-16T07:31:39Z")

</div>

> [@jethro](#):
>
> You should keep the db out of sync

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

---

<div class="post-metadata">

**Author:** ![timquelch](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@timquelch](https://org-roam.discourse.group/u/timquelch)\
**Post date:** [September 16, 2020, 7:44am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/7 "2020-09-16T07:44:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roi.holtzman](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@roi.holtzman](https://org-roam.discourse.group/u/roi.holtzman)\
**Post date:** [September 17, 2020, 6:45am UTC](https://org-roam.discourse.group/t/duplicate-ids-in-file-error/627/8 "2020-09-17T06:45:17Z")

</div>

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:

> [@chrpinedo](#):
>
> I solved deleting the org-roam.db file (I saved it just in case) and executing `org-roam-db-build-cache` .
