SOLVED: Cannot create new nodes: error `Template needs to specify ‘:if-new’`

Since upgrading to v2 I cannot create new nodes.

When I try, I am as in v1 first asked to “Select a capture template”, and presented with the menu that used to cause me to write into one of the three folders I use (public notes, private notes, and work notes). But when I select one, I get

user-error: Template needs to specify ‘:if-new’

Here’s the code (which I’ve carried over from org-roam v1) that defines my templates:

(setq org-roam-capture-templates
      ;; These folder names are dumb, but to change them I would need
      ;; to change every link involving them.
      '( ( "u" "public" plain
           (function org-roam--capture-get-point)
           "%?"
           :file-name "tech/%<%Y%m%d%H%M%S>-${slug}"
           :head "#+title: ${title}\n"
           :unnarrowed t)
         ( "r" "private" plain
	   ... )
         ( "o" "ofiscal" plain
	   ... )
         ))

Has it gone stale?

The last option in the menu I’m presented with is “[C] Customize org-roam templates”. Selecting that gives me this error:

Debugger entered--Lisp error: (invalid-read-syntax "#")
  read("\n'((\"u\" \"public\" plain #'org-roam-capture--get-poi...")
  ... <Here I'm omimtting a few really long expressions because Discourse doesn't want that many characters> ...
  widget-create(custom-variable :documentation-shown t :custom-state unknown :tag "Org Capture Templates" :value org-capture-templates)
  #f(compiled-function (entry) #<bytecode 0xc7a00d>)((org-capture-templates custom-variable))
  mapcar(#f(compiled-function (entry) #<bytecode 0xc7a00d>) ((org-capture-templates custom-variable)))
  custom-buffer-create-internal(((org-capture-templates custom-variable)))
  custom-buffer-create(((org-capture-templates custom-variable)) "*Customize Option: Org Capture Templates*")
  customize-variable(org-capture-templates)
  org-capture(nil nil)
  org-roam-capture-(:node #s(org-roam-node :file nil :file-hash nil :file-atime nil :file-mtime nil :id nil :level nil :point nil :todo nil :priority nil :scheduled nil :deadline nil :title "wuh" :properties nil :olp nil :tags nil :aliases nil :refs nil) :props (:finalize find-file :call-location #<marker at 8944 in 20200610061525-org_roam.org>))
  org-roam-node-find()
  funcall-interactively(org-roam-node-find)
  call-interactively(org-roam-node-find nil nil)
  command-execute(org-roam-node-find)

have a look at the docstring of org-roam-capture-templates and manual.
it has gone through a major update. you need to have :if-new, really.

It works! Thanks, @nobiot!

I found aping Jethro’s own .emacs file helpful.

1 Like