Find and merge duplicate nodes with org-roam

While typing something in the flow, I may accidentally create nodes while I needed to link something else. Over the time some such empty nodes are accumulated. What would be the best way to find such nodes, and merge them with existing node? Ideally to add alias right there too, so such typing issues won’t happen again.

If they are “empty”, I’d delete them, not merge or add an alias. I would simply go to my file manager in my OS, sort the directory by size, and identify which ones I can delete (“empty” would not be size zero, but it should be pretty close to it). And then select and delete them.

I am assuming all my empty nodes would be files (that’s the case for me). If nodes are headings, I would never have an empty one, because I manually add an ID to a heading that is worth being an Org-roam node.

I like this approach, and normally I would do so. However, my problem isn’t about cleaning up empty files. When I type my thoughts down, I tend to insert links about different stuff. Sometimes it doesn’t exists and I create an empty page. However, there’s a small chance that I mistyped something that does exist with a bit different name (3D printer → 3D printing). While in the flow I may not notice it and just keep on going. At the end of the day I may end up with several notes created for stuff that I didn’t want to. All of this false nodes are referenced by others. This is quite tedious work to clean up by hand. therefore I’m looking for a way to automate that.

How do you know if a node is false one? If you wish to automate cleanup, you need a formal definition to differentiate false notes from notes you want to keep.

And you want to delete the false notes? What would you like to do with them? In other words, what are you automating?

If the nodes to clean up is up to 50, it would be probably quicker and easier to do it manually than trying to automate it… You can then review your workflow to prevent this from happening.