doomemacs / doomemacs/core

emacsql-sqlite has failed immediately on opening emacs

Open
#7,319 2 comments 1 reaction 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [X] The issue can be reproduced on the **latest** available commit of Doom.

- [X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. *(Doom does not support development builds like 29+ or any version ending in .50 or .9x)*

### Expected behavior

Open emacs and have it launch successfully.

### Current behavior

emacs opens and throws an error saying emacsql-sqlite has failed immediately. Here's the output of the error:

```
Warning (initialization): An error occurred while loading ‘/home/myuser/.config/emacs/.local/etc/@/init.28.elc’:

Error caused by user's config or system: /home/myuser/.config/doom/config.el, (error /home/myuser/.config/emacs/.local/straight/build-28.2/emacsql/sqlite/emacsql-sqlite has failed immediately)

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing Disable logging
```

Here is the output from doom doctor:
```
The doctor will see you now...

> Checking your Emacs version...
> Checking for Doom's prerequisites...
> Checking for Emacs config conflicts...
> Checking for great Emacs features...
> Checking for private config conflicts...
> Checking for stale elc files...
> Checking for problematic git global settings...
> Checking Doom Emacs...
x There was an unexpected runtime error
Message: /home/myuser/.config/emacs/.local/straight/build-28.2/emacsql/sqlite/emacsql-sqlite has failed immediately
Backtrace:
(error "%s has failed immediately" "/home/myuser/.config/emacs/.local/straight/build-28.2/emacsql...
(#[385 "\305 \210\306\307\211\310\311\"\312\313!\203\314!\202\315\316\317...
(apply #[385 "\305 \210\306\307\211\310\311\"\312\313!\203\314!\202\315\316...
(#[128 "\300\211\203\211@\303\"\210A\266\202\202\210\303\302\"\301\211\203+\2...
(apply #[128 "\300\211\203\211@\303\"\210A\266\202\202\210\303\302\"\301\211\20...
(initialize-instance #s(#s(eieio--class emacsql-sqlite-connection "A connection to a SQLite dat...
(#[385 "\302\2119\203\211\303N\206\202\211\262\304>\204\"\305\306\307D...
(apply #[385 "\302\2119\203\211\303N\206\202\211\262\304>\204\"\305\306\...
(make-instance emacsql-sqlite-connection :file "~/.config/emacs/.local/cache/org-roam.db")
(emacsql-sqlite "~/.config/emacs/.local/cache/org-roam.db")
(org-roam-db)
(org-roam-db-sync)
! Wrote extended backtrace to ~/.config/emacs/.local/state/logs/cli.doom.230729095948.17487.error
```

This appears to be identical to the issue thread here on Discord: https://discord.com/channels/406534637242810369/1106846641987780660/1106846641987780660

The suggestion there was that a compile step was missing for emacsql-sqlite.

### Steps to reproduce

1. Install doom emacs fresh.
2. Activate org-roam in init.el with "(org +roam2)
3. Add extremely minimal org-roam config in config.el:
```
(after! org
(setq org-roam-directory "~/org/")
(org-roam-db-autosync-mode)
)
```
4. Run doom sync -u
5. Open emacs

(This was enough to trigger a failure some time after launch in an Ubuntu VM and on my actual system, but it didn't cause the more severe loading failure that I'm experiencing with my full config on my actual system as reported above. I'm in the process of diagnosing where my actual config is breaking things. I suspect some part of the rest of my org config is causing an immediate load of the org-roam part of my config since after dumping a huge block of the org part of my config above my org-roam part of my config, I see it causing the transition from the gentle failure to more severe loading failure)

### System Information

https://pastebin.com/SrA6re1t

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with Emacs 27 or 28, org (+roam2), and the minimal org-roam configuration, then run doom doctor and Emacs with --debug-init. Inspect the emacsql/sqlite executable under .local/straight/build-28.2 and the org-roam database initialization shown in the backtrace. Done means Emacs launches and org-roam database sync completes without the immediate emacsql-sqlite failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.