Org roam back links no longer work for me

Org roam suddenly stopped showing backlinks and I get the following error after doing C-c n l:

Invalid slot name: “#”, :value
Error in post-command-hook (magit-section-post-command-hook): (wrong-type-argument (or eieio-object class) nil obj)

Any help would be appreciated

John

(defun org-roam-buffer--setup-redisplay-h ()
  "Setup automatic redisplay of the persistent `org-roam-buffer'."
  (add-hook 'post-command-hook #'org-roam-buffer--redisplay-h nil t))

(defun org-roam-buffer--redisplay-h ()
  "Reconstruct the persistent `org-roam-buffer'.
This needs to be quick or infrequent, because this designed to
run at `post-command-hook'."
  (and (get-buffer-window org-roam-buffer)
       (org-roam-buffer-persistent-redisplay)))

The following is failing

Working on pure intuition - but lets diagnose the sql connection.

Please let me know about the value of org-roam-database-connector

Its value is ‘sqlite’

Did you copy your init config from somewhere - from searching the internet I can see that others who have talked about the issue try to enable (org-roam-mode) but this is no longer applicable.

How do you initialize org-roam, (org-roam-db-autosync-mode 1) ?

I have this in my custom.el

'(org-roam-db-autosync-mode t)

This is my org-roam config in my init.el:

;; ORG-ROAM CONFIGURATION

(require 'org-roam)
(global-set-key (kbd “C-c n l”) 'org-roam-buffer-toggle)
(global-set-key (kbd “C-c n f”) 'org-roam-node-find)
(global-set-key (kbd “C-c n i”) 'org-roam-node-insert)
(global-set-key (kbd “C-c n c”) 'org-roam-capture)

(setq org-roam-node-display-template
(concat "${title:*} "
(propertize “${tags:10}” 'face 'org-tag)))

;; This ensures backlinks in org roam open in folded position
(add-to-list 'magit-section-initial-visibility-alist (cons 'org-roam-node-section 'hide))

Do you happen to have upgraded Org and/or Magit, or separately Magit-section by any chance?

I had a similar issue with one of recent updates to magit-section that came with magit update.

If this is the case,

  1. Ensure to get the latest version of magit (or go back to the previous working one).

  2. Ensure that you do not have any stale .elc file (somehow I struggle to clean this up with the native comp on my end).

Yes, I regularly update my packages, including Magit and Magit-section, so I’m pretty sure that’s what triggered the problem.

I tried reverting to the last versions before my last upgrade and I still get the problem. But it may have started with even earlier updates, and I just didn’t notice.

You could download a tar file for a version from last year, for example, and see if it changes anything. If you have confirmed that magit-section is indeed the cause of the problem, you can raise an issue on their project.

Does no one else have this issue? I have just done regular updates and have had the same configuration for years. I don’t really have anything that isn’t standard in my setup for org roam so I would think this problem would appear for everybody.

I just downloaded the latest magit-section and evaluated it – cannot replicate the issue :slightly_frowning_face:

I even did a binary match to see changes from my version to the latest version

[~/Desktop/magit] ~> diff --color old-magit-section.el magit-section.el
599,601c599,600
< If optional RAW is non-nil, return a list of section object
< beginning with SECTION, otherwise return a list of section
< types."
---
> If optional RAW is non-nil, return a list of section objects, beginning
> with SECTION, otherwise return a list of section types."
777,782c776,780
< (advice-add 'context-menu-region :around
<             (lambda (fn menu click)
<               "Disable in `magit-section-mode' buffers."
<               (if (derived-mode-p 'magit-section-mode)
<                   menu
<                 (funcall fn menu click))))
---
> (define-advice context-menu-region (:around (fn menu click) magit-section-mode)
>   "Disable in `magit-section-mode' buffers."
>   (if (derived-mode-p 'magit-section-mode)
>       menu
>     (funcall fn menu click)))
1984c1982
< (defun isearch-clean-overlays@magit-mode (fn)
---
> (define-advice isearch-clean-overlays (:around (fn) magit-mode)
1993,1995d1990
< (advice-add 'isearch-clean-overlays :around
<             #'isearch-clean-overlays@magit-mode)
<
2414c2409
< (when (fboundp 'define-fringe-bitmap)
---
> (when (fboundp 'define-fringe-bitmap) ;for Emacs 26

Maybe the problem is emanating from somewhere else - it is hard to diagnose without triggering the issue -

can you provide a backtrace ?

toggle-debug-on-error

Away from the PC. Will try, but @akashp is not able to repro, so like he says, we may be barking at the wrong tree

This is what I get:

Debugger entered–Lisp error: (invalid-slot-name “#” :value)
signal(invalid-slot-name (“#” :value))
#f(compiled-function (object slot-name operation &optional new-value) #<bytecode 0x9815348c18a8721>)(#<magit-section nil [org-roam] nil-nil> :value oset nil)
apply(#f(compiled-function (object slot-name operation &optional new-value) #<bytecode 0x9815348c18a8721>) #<magit-section nil [org-roam] nil-nil> (:value oset nil))
slot-missing(#<magit-section nil [org-roam] nil-nil> :value oset nil)
#f(compiled-function (obj slots) “Set slots of OBJ with SLOTS which is a list of name/value pairs.\nCalled from the constructor routine.” #<bytecode -0x21ab8f4fb7caff0>)(#<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
apply(#f(compiled-function (obj slots) “Set slots of OBJ with SLOTS which is a list of name/value pairs.\nCalled from the constructor routine.” #<bytecode -0x21ab8f4fb7caff0>) #<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
shared-initialize(#<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
#f(compiled-function (this &optional args) “Construct the new object THIS based on ARGS.\nARGS is a property list where odd numbered elements are tags, and\neven numbered elements are the values to store in the tagged slot.\nIf you overload the initialize-instance', there you will need to\ncall shared-initialize’ yourself, or you can call call-next-method'\nto have this constructor called automatically. If these steps are\nnot taken, then new objects of your class will not have their values\ndynamically set from ARGS." #<bytecode 0x1a065df95c95fa72>)(#<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in *org-roam*> :parent nil)) apply(#f(compiled-function (this &optional args) "Construct the new object THIS based on ARGS.\nARGS is a property list where odd numbered elements are tags, and\neven numbered elements are the values to store in the tagged slot.\nIf you overload the initialize-instance’, there you will need to\ncall shared-initialize' yourself, or you can call call-next-method’\nto have this constructor called automatically. If these steps are\nnot taken, then new objects of your class will not have their values\ndynamically set from ARGS.” #<bytecode 0x1a065df95c95fa72>) #<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
initialize-instance(#<magit-section nil [org-roam] nil-nil> (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
#f(compiled-function (class &rest slots) “Default constructor for CLASS eieio-default-superclass'.\nSLOTS are the initialization slots used by initialize-instance’.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls initialize-instance' on that object." #<bytecode -0x16e0c74dcee02d1a>)(magit-section :type org-roam :value nil :start #<marker at 1 in *org-roam*> :parent nil) apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS eieio-default-superclass’.\nSLOTS are the initialization slots used by initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls initialize-instance’ on that object.” #<bytecode -0x16e0c74dcee02d1a>) magit-section (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
make-instance(magit-section :type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil)
apply(make-instance magit-section (:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil))
magit-section(:type org-roam :value nil :start #<marker at 1 in org-roam> :parent nil)
org-roam-buffer-render-contents()
org-roam-buffer-persistent-redisplay()
org-roam-buffer-toggle()
funcall-interactively(org-roam-buffer-toggle)
call-interactively(org-roam-buffer-toggle nil nil)
command-execute(org-roam-buffer-toggle)

I should mention that I have two totally different distros, popos 22.04 and manjaro i3 and the first runs emacs 28 and the second emacs 29. And the problem occurs in both. I also have a .emacs folder with different packages that sets up to use vertico instead of helm, and it occurs in that version of emacs as well.

Interesting, we can debug more I suspect two functions -

but consider this,
https://www.reddit.com/r/OrgRoam/comments/1cmto1v/anybody_else_have_problem_with_orgroambuffertoggle/

A user claimed that purging everything and reinstalling solved problems – strange.

i would begin by deleting first the folder .emacs.d/eln-cache/ if it exists - this will be recreated trivially so no problems - if it doesn’t solve I would try to delete all elpa packages and reinstall fresh - many users claim this solved their issues in the past month.

Thanks guys. I went to the reddit discussion you linked to and did what a person suggested, I deleted my two org roam packages, org-roam and org-roam-bibtex and then reinstalled them. The emacsql recompiled and now everything seems to be working.

I’m no computer guy, but it seems org-roam needs to be recompiled after doing an update of magit so as to work with those new versions. It needs to compile in links to those packages somehow?

Anyway, thanks so much for getting back so quickly. You are lifesaver and a godsend!!!

1 Like