# Error "Selecting deleted buffer" latest emacs build

**URL:** <https://org-roam.discourse.group/t/error-selecting-deleted-buffer-latest-emacs-build/2953>\
**Category:** Troubleshooting\
**Created:** [January 17, 2023, 9:09pm UTC](https://org-roam.discourse.group/t/error-selecting-deleted-buffer-latest-emacs-build/2953 "2023-01-17T21:09:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![artelse](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@artelse](https://org-roam.discourse.group/u/artelse)\
**Post date:** [January 17, 2023, 9:09pm UTC](https://org-roam.discourse.group/t/error-selecting-deleted-buffer-latest-emacs-build/2953/1 "2023-01-17T21:09:07Z")

</div>

I compiled the latest Emacs 30 from main and got below error when Emacs starts up.  
After some searching recompiled sqlitedb to no avail. Any ideas?

```auto
Debugger entered--Lisp error: (error "Selecting deleted buffer")
  #f(compiled-function (connection) "Return true if the end of the buffer has a properly-formatted prompt." #<bytecode 0x1f119f66cd5a7127>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090>)
  apply(#f(compiled-function (connection) "Return true if the end of the buffer has a properly-formatted prompt." #<bytecode 0x1f119f66cd5a7127>) #<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> nil)
  emacsql-waiting-p(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090>)
  #f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1be680c649257bcc>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090>)
  apply(#f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1be680c649257bcc>) #<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> nil)
  emacsql-wait(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090>)
  #f(compiled-function (connection sql &rest args) #<bytecode -0x98c0e448cf60464>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> [:pragma (= busy-timeout $s1)] 15000)
  apply(#f(compiled-function (connection sql &rest args) #<bytecode -0x98c0e448cf60464>) #<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> ([:pragma (= busy-timeout $s1)] 15000))
  emacsql(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> [:pragma (= busy-timeout $s1)] 15000)
  #f(compiled-function (connection &rest rest) #<bytecode 0x8aaf9eb786f5542>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> (:file "~/.config/emacs/ae/org-roam.db"))
  apply(#f(compiled-function (connection &rest rest) #<bytecode 0x8aaf9eb786f5542>) (#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> (:file "~/.config/emacs/ae/org-roam.db")))
  #f(compiled-function (&rest args) #<bytecode 0x1d0de56ae1e91d21>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> (:file "~/.config/emacs/ae/org-roam.db"))
  apply(#f(compiled-function (&rest args) #<bytecode 0x1d0de56ae1e91d21>) #<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> (:file "~/.config/emacs/ae/org-roam.db"))
  initialize-instance(#<emacsql-sqlite-connection emacsql-sqlite-connection-158efb93c090> (:file "~/.config/emacs/ae/org-roam.db"))
  #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 0x4452e5f3afa779e>)(emacsql-sqlite-connection :file "~/.config/emacs/ae/org-roam.db")
  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 0x4452e5f3afa779e>) emacsql-sqlite-connection (:file "~/.config/emacs/ae/org-roam.db"))
  make-instance(emacsql-sqlite-connection :file "~/.config/emacs/ae/org-roam.db")
  emacsql-sqlite("~/.config/emacs/ae/org-roam.db")
  org-roam-db()
  org-roam-db-sync()
  org-roam-db-autosync-mode(1)
  org-roam-setup()

```

---

<div class="post-metadata">

**Author:** ![artelse](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@artelse](https://org-roam.discourse.group/u/artelse)\
**Post date:** [January 18, 2023, 8:45am UTC](https://org-roam.discourse.group/t/error-selecting-deleted-buffer-latest-emacs-build/2953/2 "2023-01-18T08:45:57Z")

</div>

`emacsql` package needed to be updated, see [here](https://github.com/magit/emacsql/commit/3cec7dcb201568a09ee9cebf0ea1e43cba9d334a).

---

<div class="post-metadata">

**Author:** ![QingshuiZheng](https://avatars.discourse-cdn.com/v4/letter/q/87869e/32.png) [@QingshuiZheng](https://org-roam.discourse.group/u/QingshuiZheng)\
**Post date:** [January 19, 2023, 5:14am UTC](https://org-roam.discourse.group/t/error-selecting-deleted-buffer-latest-emacs-build/2953/3 "2023-01-19T05:14:51Z")

</div>

Latest commit solved the issue:

> <https://github.com/magit/emacsql/commit/2e6056df110e76da4eabb413f8781c4f1edddf20>
>
> If the buffer (and thus the process) are killed, then waiting for the
> process do…esn't make sense anymore, and would result in a confusing
> error.
