I’ve just switched machines. I’ve set up org-roam on my new machine and imported my library of orgfiles. (I didn’t copy the db.) When I tried to find a file, the list was empty.
I tried to create new nodes and they appear in the history. I can find these, but opening them returns error:
org-id-open: Cannot find entry with ID “d359e450-3ee8-439a-8e5a-08993ff05bc2”
Deleting my db, results in only finding the new files, even if I delete those files from my org-roam-directory.
I’m running Window10.
I’m using Spacemacs develop for my config.
org-roam-directory “~/repos/org-roam/data/”
org-roam-db-location “~/repos/org-roam/data/org-roam.db”
in my .emacs.d it has org-roam-20220121.2350
I think the problem is that I must have been on an earlier version of org-roam before I moved machines.
How do I fix my org-roam to find my existing files?
I also have a linux machine that still works. Do I have to update that as well so the org-roam files may work between the two.
Simply deleting the db file and rebuilding it on Windows with org-roam-db-sync should be enough.
If this does not do, then this is probably because something else is interfering (e.g. something from Spacemacs).
The org-id-open problem happens because your Org-roam does not have the ID in the db. So fixing the db issue should resolve it. You should also use org-roam-update-id (or some similar name) AFTER you have fixed the db issue. This will get the org-id cache/file updated (it’s not an org-roam issue, it’s org-id issue, but org-roam provides this utility command to get org-id and org-roam consistent).
The fact that you had an older db version is unlikely a problem. It only affects the db file, which you didn’t carry over. The newly installed org-roam will create a new db file.
The org-roam in Linux should not be relevant as long as you don’t sync the db file between Windows and Linux (I don’t think you do this).
By the way, this indicates to me that you are not deleting
the correct db file or deleting files in the wrong directly. Hard to be sure but I think your config of org-roam-directory and/or db file location is not correct. You should double check your config.
If you are able to delete a db file from within Emacs or from Windows Explorer when Org-roam is in use, then that’s not the db your Emacs is using. On Windows, once a db file is opened by Emacs/Org-roam, you can’t change/delete it from Windows because Emacs locks it.
Your conclusions make sense. Here’s some more details:
If I try to delete it with emacs open - it errors:
The action cannot be completed because the file is open in emacsql-sqlite.exe
Closing emacs allows me to delete it.
Restarting emacs it has “Processing modified files…done” in Messages
And only has the new files created. None of the original files.
org-roam.db has been recreated in C:\Users\Richard.East\repos\org-roam\data
In .spacemacs.env, I have:
HOME=C:\Users\Richard.East
HOMEDRIVE=C:
HOMEPATH=\Users\Richard.East
If I search my harddrive for org-roam.db
I only find it in C:\Users\Richard.East\repos\org-roam\data
running the describe-variable function inside emacs for the roam following roam settings remain the same:
org-roam-directory “~/repos/org-roam/data/”
org-roam-db-location “~/repos/org-roam/data/org-roam.db”
Running org-roam-db-sync, completes very quickly.
I think the problem may be with sqlite. I installed it using the instructions - here using the scoop install method.
I’ll try deleting sqlite from my elpa directory and reinstall it. (Fingers crossed)
I wrote this part. It’s old (it’s an old manual that you should not rely on) and since then scoop has become unable to correctly install gcc (issue); it might have some new development around November in 2021, but I won’t confirm now. See if your gcc installation is done correctly typing gcc --version in cmd or PowerShell.
Try the current manual or this. Alternatively, consider emacsql-sqlite3 option.
I followed the instructions in the manual and installed SQLite through MSYS2.
On startup emacs was able to compile sqlite.
I ran Org-Roam-Db-Autosync mode, which reported “Processing modified files…done” and it did take a while to complete.
I ran org-roam-update-id-location, which came back with: “1724 files scanned, 0 files contains IDs, and 0 IDs found.”
You say you have installed SQLite through MSYS2. That’s not what the manual instructs; you are supposed to install GCC (a C compiler) through MSYS2. You don’t need SQLite from MSYS. emacsql-sqlite comes with a custom C source for SQLite database and GCC is used to compile it so that Emacs can use it via emacsql-sqlite.
Or… if you can add a new node, and confident that DB is working, perhaps the Org notes you carried over do not have IDs? (Sorry, that’s the only explanation I can have at the moment).
I followed the instructions and added C:\msys64\usr\binPATH
Launching Emacs and calling M-x org-roam-db-autosync-mode first disabled the mode so I would run it again. This would process the files.
Beyond the instructions I ran org-roam-update-id-location.
perhaps the Org notes you carried over do not have IDs? (Sorry, that’s the only explanation I can have at the moment).
Yes - This is the case. For example I have a node for Graphql. File name is 20200818155128-graphql and the contents are:
#+title: GraphQL
#+roam_tags: graph query language API
GraphQL
A query language for your API
My other computer runs linux and works without any ids in the files. Is this an addition to org-roam that I haven’t accounted for?
For Org-roam V2, the current major version, it only saves “nodes” in the database. Each node is defined as a file or headline that has an ID (ID property in the property drawer).
Perhaps your Linux computer is using Org-roam V1 (roam_tags are no longer used in V2, which uses the Org’s filetags). V1 is file-based. V2 is ID-based (“node” based).
There is a migration tool (provided by Org-roam) to convert V1 files to V2 nodes…
This must be the case. I didn’t know that the new computer was on org-roam v2. I will try to migrate both the Windows and Linux systems to V2.
One quick question before I do that; In my original message, I said that I deleted the new test nodes I created. These two nodes still appear. I’ve been unable to remove them. How do I remove them, so they will not appear after I update to V2?
If I understand your situation correctly, you have deleted the files but the cache remains in the database – is this correct? Then deleting the database file deletes them, and you will be back to the clean slate.
So as a test, I ran org-roam-node-insert and it shows to the two test nodes that I thought didn’t physically exist, I select one and it opens a capture buffer containing:
:PROPERTIES:
:ID: 880cc1eb-9468-4b09-9f69-837f858658b0
:END:
#+title: john
As I don’t want to keep it, I run org-kill-capture
and view messages
Wrote c:/Users/Richard.East/repos/org-roam/data/20220216165736-john.org
(org-roam) Deleting file for aborted capture c:/Users/Richard.East/repos/org-roam/data/20220216165736-john.org
Auto-saving...done
I’ve checked for hidden files in my org-roam/data folder, but there isn’t any. If your view is the files exist, I don’t doubt you, but I cannot locate them. I only hope this reply gives you some further insight and is useful.
I see. Then I have no idea. You delete the db file and all the org files in the directory. Next time you run org-roam-roam-db-sync (automatic or manual), it will look at existing org files to create a new org db and update it. In this chain of functions, I don’t see how deleted files get into the new db file.
One thing that looks strange to me is that you put your customisation to change the location of the db file to be the same as your org files (default is in your config folder). Do you happen to sync the db file with a Cloud service? If so, is it possible that it retrieved the deleted files (org or db) from the Cloud without your knowing it?
Or is it synced with Linux? If your Linux is running V1, it’s possible that its default db location is org-roam-directory. In V2 (and more recent version of V1), its default location is your Emacs config folder. Perhaps you are deleting the V1 db file and not the V2 db file?