# Org-roam backlinks / org-roam-buffer-toggle issues in V2

**URL:** <https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822>\
**Category:** Troubleshooting\
**Created:** [July 24, 2021, 9:27pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822 "2021-07-24T21:27:50Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![emacsomancer](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/emacsomancer/32/532_2.png) [@emacsomancer](https://org-roam.discourse.group/u/emacsomancer)\
**Post date:** [July 24, 2021, 9:27pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/1 "2021-07-24T21:27:50Z")

</div>

I had no issues with backlinks in V2, but in V2 many files produce various sorts of `Wrong type argument` errors and fail to show backlinks.

Here an example of one such error, when trying to call `org-roam-buffer-toggle`:

```auto
org-roam-node-insert-section: Wrong type argument: char-or-string-p, (1 193 #("- [[https://org-roam.discourse.group/t/zero-to-emacs-and-org-roam-a-step-by-step-guide-on-windows-10/400][Zero to Emacs and Org-roam: a step-by-step guide on Windows 10 - Guides - Org-roam]]" 0 2 (line-prefix #(" " 0 2 (face org-indent)) wrap-prefix #(" " 0 2 (face org-indent) 2 4 (face org-indent)))))
Error in post-command-hook (org-roam-buffer--redisplay-h): (wrong-type-argument char-or-string-p (1 1436 ""))
Error in post-command-hook (magit-section-update-highlight): (wrong-type-argument number-or-marker-p nil)

```

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 25, 2021, 12:34pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/2 "2021-07-25T12:34:35Z")

</div>

I can’t reproduce the issue on my very vanilla Emacs 27.2.  
I don’t seem to have `org-roam-buffer--redisplay-h` in my system; I have `org-roam-buffer--redisplay` instead. You might like to upgrade Org-roam to the latest and see if the problem persists?

I initially suspected that the colon “:” character was the cause; this does not seem to be the case.

If upgrading does not fix the problem, you might like to get the error stack by doing `toggle-error-on-error`.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/5c73a293201254ecf4ed44cdcac3e8e25119a0c0.png)

---

<div class="post-metadata">

**Author:** ![emacsomancer](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/emacsomancer/32/532_2.png) [@emacsomancer](https://org-roam.discourse.group/u/emacsomancer)\
**Post date:** [July 25, 2021, 3:52pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/3 "2021-07-25T15:52:13Z")

</div>

updated to today’s version, tried turning off some things like org-appear in case they were interfering, but I’m still running into the same issues.

Here’s the error stack with `toggle-debug-on-error`when I call `org-roam-buffer-toggle`:

```auto
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p (1 210 ""))
  org-roam-fontify-like-in-org-mode((1 210 ""))
  org-roam-node-insert-section(:source-node #s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/daily/2021-02-0..." :file-hash nil :file-atime (24825 42965 4814 612000) :file-mtime (24821 47505 262397 535000) :id "41b3650a-7f38-4c18-bee3-af22662d48b4" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "2021-02-02" :properties (("CATEGORY" . "2021-02-02") ("ID" . "41b3650a-7f38-4c18-bee3-af22662d48b4") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/daily/2021-02-0...") ("PRIORITY" . "C")) :olp nil :tags ("daily_journal") :aliases nil :refs nil) :point 210 :properties (:outline nil))
  org-roam-backlinks-section(#s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/20210102184440-..." :file-hash nil :file-atime (24825 42965 374809 471000) :file-mtime (24819 35310 129717 79000) :id "257a4042-830b-4397-9a7a-d245eaea3c52" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "Linux" :properties (("CATEGORY" . "20210102184440-linux") ("ID" . "257a4042-830b-4397-9a7a-d245eaea3c52") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/20210102184440-...") ("PRIORITY" . "C")) :olp nil :tags nil :aliases nil :refs nil))
  run-hook-with-args(org-roam-backlinks-section #s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/20210102184440-..." :file-hash nil :file-atime (24825 42965 374809 471000) :file-mtime (24819 35310 129717 79000) :id "257a4042-830b-4397-9a7a-d245eaea3c52" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "Linux" :properties (("CATEGORY" . "20210102184440-linux") ("ID" . "257a4042-830b-4397-9a7a-d245eaea3c52") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/20210102184440-...") ("PRIORITY" . "C")) :olp nil :tags nil :aliases nil :refs 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)

```

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 25, 2021, 6:11pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/4 "2021-07-25T18:11:18Z")

</div>

Is it possible that the file with ID completely empty?  
`257a4042-830b-4397-9a7a-d245eaea3c52`

---

<div class="post-metadata">

**Author:** ![emacsomancer](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/emacsomancer/32/532_2.png) [@emacsomancer](https://org-roam.discourse.group/u/emacsomancer)\
**Post date:** [July 25, 2021, 7:57pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/5 "2021-07-25T19:57:55Z")

</div>

the file associated with ID 257a4042-830b-4397-9a7a-d245eaea3c52 is [2021012184440-linux.org](http://2021012184440-linux.org) and it contains regular org-roam stuff in it (#+title etc. body text). That’s actually the file I was calling `org-roam-buffer-toggle` on (in other words, I was trying to get its backlinks).

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 25, 2021, 8:35pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/6 "2021-07-25T20:35:01Z")

</div>

> [@emacsomancer](#):
>
> `41b3650a-7f38-4c18-bee3-af22662d48b4`

or this one.

My guess is that it’s essentially a data issue in one of the files.  
The stack trace seems to me that Org-roam tries to insert the backlink section for a file. For some reason, it finds an empty string as indicated here: org-roam-fontify-like-in-org-mode((1 210 “”)).

If all the backlink files look fine, I would put a debugging point in this function (and the one before, org-roam-node-insert-section) and go through edebugging sessions.

If data issue, it could point to a defect in the migration script if you used it.

> [@emacsomancer](#):
>
> the file associated with ID 257a4042-830b-4397-9a7a-d245eaea3c52 is [2021012184440-linux.org](http://2021012184440-linux.org) and it contains regular org-roam stuff in it (#+title etc. body text). That’s actually the file I was calling `org-roam-buffer-toggle` on (in other words, I was trying to get its backlinks).

edit: I don’t have the same problem. It would be very difficult for others to reproduce it. For that, you would need to identify and share the file(s) that cause the problem…

---

<div class="post-metadata">

**Author:** ![emacsomancer](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/emacsomancer/32/532_2.png) [@emacsomancer](https://org-roam.discourse.group/u/emacsomancer)\
**Post date:** [July 25, 2021, 10:43pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/7 "2021-07-25T22:43:43Z")

</div>

I don’t think it’s a data error. The other ID is a dailies file which is full of content. And I get this with most files, not just this one.

The org-roam-fontify-like-in-org-mode((1 210 “”)) pattern is consistent too - the second number is the “character number” of the first character in the backlink from that file to the file I started from.

Here’s the error I get from first file I mentioned (in the first post):

```auto
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p (1 193 #("- [[https://org-roam.discourse.group/t/zero-to-ema..." 0 2 (wrap-prefix #(" " 0 4 (face org-indent)) line-prefix #(" " 0 2 (face org-indent))))))
  org-roam-fontify-like-in-org-mode((1 193 #("- [[https://org-roam.discourse.group/t/zero-to-ema..." 0 2 (wrap-prefix #(" " 0 4 (face org-indent)) line-prefix #(" " 0 2 (face org-indent))))))
  org-roam-node-insert-section(:source-node #s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/daily/2020-12-1..." :file-hash nil :file-atime (24829 23902 394750 615000) :file-mtime (24821 47507 185731 60000) :id "f5f62cef-f183-4e28-a307-aa1ba7f78992" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "2020-12-18" :properties (("CATEGORY" . "2020-12-18") ("ID" . "f5f62cef-f183-4e28-a307-aa1ba7f78992") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/daily/2020-12-1...") ("PRIORITY" . "C")) :olp nil :tags ("daily_journal") :aliases nil :refs nil) :point 193 :properties (:outline nil))
  org-roam-backlinks-section(#s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/20201218193400-..." :file-hash nil :file-atime (24829 23895 258185 739000) :file-mtime (24819 35306 583100 326000) :id "a74d5938-5747-4e2a-871a-8d6019495617" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "Emacs" :properties (("CATEGORY" . "20201218193400-emacs") ("ROAM_ALIASES" . "EMACS emacs \"GNU Emacs\"") ("ID" . "a74d5938-5747-4e2a-871a-8d6019495617") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/20201218193400-...") ("PRIORITY" . "C")) :olp nil :tags nil :aliases ("EMACS" "emacs" "GNU Emacs") :refs nil))
  run-hook-with-args(org-roam-backlinks-section #s(org-roam-node :file "/home/emacsomancer/Documents/Org/org-roam/20201218193400-..." :file-hash nil :file-atime (24829 23895 258185 739000) :file-mtime (24819 35306 583100 326000) :id "a74d5938-5747-4e2a-871a-8d6019495617" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "Emacs" :properties (("CATEGORY" . "20201218193400-emacs") ("ROAM_ALIASES" . "EMACS emacs \"GNU Emacs\"") ("ID" . "a74d5938-5747-4e2a-871a-8d6019495617") ("BLOCKED" . "") ("FILE" . "/home/emacsomancer/Documents/Org/org-roam/20201218193400-...") ("PRIORITY" . "C")) :olp nil :tags nil :aliases ("EMACS" "emacs" "GNU Emacs") :refs nil))

```

Again here the `(wrong-type-argument char-or-string-p (1 193 #("- ...` - 193 is the character number in the file of the first character in the backlink in the file.

I’ll try debugging the functions when I have a chance, since it doesn’t look like data errors to me. (I tried deleting the .db file and forcing org-roam to rebuild it - which didn’t help either.)

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 26, 2021, 5:38am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/8 "2021-07-26T05:38:20Z")

</div>

Possibly the same as this GutHub issue? Jethro is making a new PR.

> <https://github.com/org-roam/org-roam/issues/1674>
>
> \### Description
> 
> If I have a headline linking to the node TARGET, then the org…-roam buffer (for TARGET) encounters an error when inserting the preview section.
> 
> \#### Steps to Reproduce
> 
> 1. Create two nodes, SOURCE and TARGET
> 2. In SOURCE, create a headline like \`\* \[\[id:2757f654-6ead-458b-83d7-f942e1552a48\]\[TARGET\]\]\` with some content.
> 3. Visit TARGET and open the org-roam buffer
> 4. The org-roam buffer does not display the content of the section as a preview, and an error is printed in \`\*Messages\*\`.
> 
> \#### Backtrace
> 
> No backtrace appears when debug on error is enabled, but a message like the following is printed:
> 
> \`\`\`
> org-roam-node-insert-section: Wrong type argument: char-or-string-p, (1 3240 "text of the section...")
> \`\`\`
> 
> \#### Expected Results
> 
> The section preview should show up in the org-roam buffer.
> 
> \#### Actual Results
> 
> The headline for the node displays in the org-roam buffer, but the buffer ends there. No preview text is displayed.
> 
> \### Environment
> 
> \- Framework: N/A
> \- Org: Org mode version 9.4.4 (9.4.4-25-g3a522a-elpaplus @ /home/tracy/.emacs.d/elpa/org-plus-contrib-20210301/)
> \- Org-roam: 2.0.0- Emacs: GNU Emacs 28.0.50 (build 1, x86\_64-pc-linux-gnu, GTK+ Version 3.24.25, cairo version 1.16.0)
> of 2021-07-22

Edit: @emacsomancer the PR is now merged. Perhaps you can try to see if it solves your issue?

---

<div class="post-metadata">

**Author:** ![eli](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@eli](https://org-roam.discourse.group/u/eli)\
**Post date:** [July 26, 2021, 7:51am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/9 "2021-07-26T07:51:43Z")

</div>

> [@nobiot](#):
>
> I don’t seem to have `org-roam-buffer--redisplay-h` in my system;

About backlinks sections and org-roam-buffer-toggle, I have got [a related error](https://github.com/org-roam/org-roam/issues/1625) in the newest commit:  
`Error in post-command-hook (org-roam-buffer--redisplay-h): (wrong-type-argument arrayp nil)`.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 26, 2021, 8:24am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/10 "2021-07-26T08:24:18Z")

</div>

> [@eli](#):
>
> org-roam-buffer–redisplay-h

@eli refer to my comment earlier. I don’t have this function in my system. I believe you would need to update Org-roam first and see if the problem persists.

---

<div class="post-metadata">

**Author:** ![eli](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@eli](https://org-roam.discourse.group/u/eli)\
**Post date:** [July 26, 2021, 8:36am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/11 "2021-07-26T08:36:30Z")

</div>

I have upgraded to the newest reversion: [20210726.548], and the functions is defined in [org-roam-mode.el](https://github.com/org-roam/org-roam/blob/6dc8dda5e59765d3e4629469f4a400b315e92a51/org-roam-mode.el#L272)

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 26, 2021, 8:42am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/12 "2021-07-26T08:42:39Z")

</div>

Got it. Apologies; it was me who needed upgrade.

I don’t see the relation between your issue you raised in GitHub, and the one we are trying to deal with here. Yours seems to be related to the unlinked-references.

Where do you see connections?

---

<div class="post-metadata">

**Author:** ![eli](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@eli](https://org-roam.discourse.group/u/eli)\
**Post date:** [July 26, 2021, 8:49am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/13 "2021-07-26T08:49:40Z")

</div>

> [@nobiot](#):
>
> Where do you see connections?

sorry, it’s my fault

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [July 26, 2021, 9:35am UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/14 "2021-07-26T09:35:54Z")

</div>

Please don’t apologise for this. It was a pure question; I don’t see anything wrong with what you have said/done here.

These issues can be related, or I might have misunderstood something. It’s good to have different eyes looking at issues from different angles.

---

<div class="post-metadata">

**Author:** ![emacsomancer](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/emacsomancer/32/532_2.png) [@emacsomancer](https://org-roam.discourse.group/u/emacsomancer)\
**Post date:** [July 26, 2021, 3:51pm UTC](https://org-roam.discourse.group/t/org-roam-backlinks-org-roam-buffer-toggle-issues-in-v2/1822/15 "2021-07-26T15:51:20Z")

</div>

Reading the description, it sounds exactly like what is happening for me.

And, installing the latest from Melpa… yep, it’s fixed!

[resolved by [(fix)preview: fix link preview when headline contains link by jethrokuan · Pull Request #1676 · org-roam/org-roam · GitHub](https://github.com/org-roam/org-roam/pull/1676) ]
