Saving a file with multiple nodes gives SQL constraint violation

I have a couple files that have multiple nodes (like an inbox.org) and sometimes when I modify the file and save it I get a handful of messages in the *Warnings* buffer, e.g.:

Warning (org-roam): SQL constraint violation: "UNIQUE constraint failed: nodes.id" for remove vega lite dependency (41e9709b-1cd1-49a7-890c-0e9e5e135f0f) in /Users/dustin/org/next.org 

in the file that looks like this:

* TODO remove vega lite dependency
:PROPERTIES:
:ID: 41e9709b-1cd1-49a7-890c-0e9e5e135f0f
:END:

i haven’t been able to nail down the reproduce path but it happens quite often.

Is there a way to at least silence this warning since it doesn’t seem to be a real problem?

I am facing the same issue and tried to find the solution.

Though I do not cover all cases where this warning shows, since there may be real problems when this message is showed, it is better for us NOT to silence all cases in my opinion.

  1. ID duplication: for example, accidentally copy and paste entry
  2. Unsaved file: If we do not save the source (destination also?) file, this warning often appears. By saving related files before calling org-refile, the warning can be avoid.
  3. other cases: there may be bugs in org-roam implementation?

Issues and pull requests related to this warning were created on github page.
You may be able to find workaround.

Correction 2024-08-23

it is better for us to silence all cases in my opinion

it is better for us NOT to silence all cases in my opinion

You can the duplicated nodes as follows:

  1. Find the sqlite database. Mine is in ~/org-roam.db
  2. run sqlite: sqlite3 ~/org-roam.db
  3. execute the following query:

select * from nodes where id = ‘“41e9709b-1cd1-49a7-890c-0e9e5e135f0f”’;

this will tell you where the duplicated id is located.

2 Likes

sorry,
it is better for us NOT to silence all cases in my opinion

This warning message is shown in several cases.
I am not sure this is true of your situation,
but using org-roam-refile instead of org-refile may avoid this warning if you see the message by calling org-refile.