You get ~Wrong type argument: stringp, nil~ error when you
=org-babel-tangle= on a source block in capture buffer.

To reproduce:

1. set a template
     (setq org-capture-templates
           '(("t" "Test" entry (file "/tmp/debug.org")
              "* TODO %?\n  %i\n  %a")))

2. Create a source block (C-c C-, s) add :tangle header
3. Tangle it. (C-u C-c C-v C-t)

In fact,at the same time with capture buffer active if you go the file
(/tmp/debug.org) and do tangle on so far written src block it tangles
properly.


Emacs  : GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0)
Package: Org mode version 9.7.6 (9.7.6-7a4527 @ /nix/store/w3f4jzqljh96z8axnp7fc814vg47879b-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.7.6/)

Best,
Dilip