# Org-roam does not update the database, only after Emacs reboot

**URL:** <https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244>\
**Category:** Troubleshooting\
**Created:** [September 27, 2023, 9:17pm UTC](https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244 "2023-09-27T21:17:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tolisin](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@Tolisin](https://org-roam.discourse.group/u/Tolisin)\
**Post date:** [September 27, 2023, 9:17pm UTC](https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244/1 "2023-09-27T21:17:43Z")

</div>

Hey there,

I have upgraded to v2 and adjusted my configuration accordingly. However, the org-roam database is only updated when I restart Emacs. Is there something wrong in my config with respect to v2?

```auto
(use-package org-roam
    :after org
    :custom
    (org-roam-directory "~/org/roam/")
    (org-roam-capture-templates
     '(("d" "default" plain
        "%?"
        :if-new (file+head "${slug}.org" "#+title: ${title}\n")
        :unnarrowed t)
       ("p" "people" plain
        "%?"
        :if-new (file+head "${slug}.org" "#+title: ${title}\n#+filetags: people")
        :unnarrowed t))
    (org-roam-dailies-directory "journal/")
    (org-roam-dailies-capture-templates
     '(("d" "default" entry
        "* %?"
        :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n#+filetags: journal")
        :empty-lines 1)))
    :bind (("C-c n l" . org-roam-buffer-toggle)
           ("C-c n f" . org-roam-node-find)
           ("C-c n i" . org-roam-node-insert)
           ("C-c n d n" . org-roam-dailies-capture-today)
           ("C-c n d d" . org-roam-dailies-goto-today)
           ("C-c n d Y" . org-roam-dailies-capture-yesterday)
           ("C-c n D y" . org-roam-dailies-goto-yesterday)
           ("C-c n d T" . org-roam-dailies-capture-tomorrow)
           ("C-c n d t" . org-roam-dailies-goto-tomorrow))
    :config
    (org-roam-db-autosync-mode t))

```

---

<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:** [October 1, 2023, 6:09am UTC](https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244/2 "2023-10-01T06:09:33Z")

</div>

You might have already found the issue, but just in case.

2 things:

1. `(org-roam-capture-templates` is not closed properly
2. Remove `:after org`

This below works for me.

```auto
(use-package org-roam
  ;;:after org
  :custom
  (org-roam-directory "~/org/roam/")
  ;; (org-roam-database-connector 'sqlite-builtin) ; I use sqlite built-in with Emacs 29, instead of the Org-roam default
  (org-roam-capture-templates
   '(("d" "default" plain
      "%?"
      :if-new (file+head "${slug}.org" "#+title: ${title}\n")
      :unnarrowed t)
     ("p" "people" plain
      "%?"
      :if-new (file+head "${slug}.org" "#+title: ${title}\n#+filetags: people")
      :unnarrowed t)))
  (org-roam-dailies-directory "journal/")
  (org-roam-dailies-capture-templates
   '(("d" "default" entry
      "* %?"
      :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n#+filetags: journal")
      :empty-lines 1)))
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n d n" . org-roam-dailies-capture-today)
         ("C-c n d d" . org-roam-dailies-goto-today)
         ("C-c n d Y" . org-roam-dailies-capture-yesterday)
         ("C-c n D y" . org-roam-dailies-goto-yesterday)
         ("C-c n d T" . org-roam-dailies-capture-tomorrow)
         ("C-c n d t" . org-roam-dailies-goto-tomorrow))
  :config
  (org-roam-db-autosync-mode t))

```

---

<div class="post-metadata">

**Author:** ![Tolisin](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@Tolisin](https://org-roam.discourse.group/u/Tolisin)\
**Post date:** [October 3, 2023, 8:35am UTC](https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244/3 "2023-10-03T08:35:39Z")

</div>

Thanks, that did the trick (parenthesis are a pain sometimes 🙂)

On question though: Why removing “:after org”? org-roam depends on org-mode, right? So loading it afterwards would be logical.

---

<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:** [October 3, 2023, 10:15am UTC](https://org-roam.discourse.group/t/org-roam-does-not-update-the-database-only-after-emacs-reboot/3244/4 "2023-10-03T10:15:16Z")

</div>

> [@Tolisin](#):
>
> parenthesis are a pain sometimes

I can understand this sentiment. It took me some time to fix this code. The original you pasted failed at start up when I tested it, so that was a clear indication for me.

If you turn on highlighting matching parentheses, you can see that `org-roam-capture-temples` do not close but the next `org-roam-dailies-directory` starts. You then press TAB to indent, this indentation changes. That’s another indication that there is unbalanced parentheses.

![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/c/c68842282048f6d14ad41330f8a4038b3d069618.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/6/60346f8045c26012f804e31f11f86f73a2514c6e.png)

> [@Tolisin](#):
>
> Why removing “:after org”?

It is logical. But when I had `:after org`, the keybindings set in `:bind` didn’t work without loading Org. I want to call `org-roam-node-find` before that — it is possible and is what is meant by this `:bind` part. You might like to check this on your end. Or you always load Org first so it may not be an issue for you.

From my testing, I have learned that if you keep `:after org`, the `:bind` part also gets deferred to after Org. This means you cannot use these keybindings until you load Org. I don’t think this is what you mean in this part of the configuration. I don’t load Org until I need it because it slows down Emacs startup.

If you remove `:after org`, you can use the keybindings immediately after startup without Org loaded, and you can use both Org and Org-roam correctly because Org-roam loads Org when it is not yet loaded (via `require` inside Org-roam’s code).
