Skip to main content
This runbook covers a Beads database that will not open, in embedded mode (the default, data in .beads/embeddeddolt/) and in server mode (data in .beads/dolt/ by default). Many errors that look like corruption are not, so diagnose first and change nothing on disk until you know which case you have.

Symptoms

  • The server is unavailable (server mode only): bd reports that the Dolt server is not running or not accepting connections. Check bd dolt status and the server log, .beads/dolt-server.log (in shared server mode, ~/.beads/shared-server/dolt-server.log). A stopped server is not corruption: start it with bd dolt start. If the log reports a corrupted journal, continue with Engine won’t open.
  • The database is locked or busy: bd reports database is locked, or waits, after another command was interrupted or while agents are running. See Lock errors after an interrupted command.
  • The engine reports a journal or open error: every bd command fails while opening the database, for example with corrupted journal or possible data loss detected in journal file, even though no other bd process is running. Continue with Engine won’t open.

Lock errors after an interrupted command

After an interrupted or killed command you may find a lock file left behind (in embedded mode a LOCK pathname inside the database’s .dolt/ directory), or see database is locked errors on the next command. A leftover lock file is not evidence of a held lock. Dolt takes its locks through the operating system, and the kernel releases a process’s file locks when the process dies, so a lock left behind by a killed command is normally already released: an existing LOCK file alone diagnoses nothing. Live contention means another process is still using the database right now: in embedded mode another bd process (often an agent or a script still running a batch) working in the same workspace, in server mode the Dolt server. It is resolved by waiting for or stopping the actual holder, not by rebuilding the database. bd dolt stop stops a server that bd manages; it cannot stop an arbitrary embedded bd process. End that process yourself after confirming it is really yours to stop:
Never delete files inside .dolt/ (including noms/LOCK) to clear a lock. Lock files are part of the engine’s on-disk format; deleting engine internals is what actually risks corruption, which is why bd doctor refuses to touch Dolt-internal lock files. Retry once the holder is gone. Only if every bd command still fails to open the database with no holder left, continue with Engine won’t open.

Engine won’t open

bd doctor --fix does not rebuild a journal the engine cannot open, and general bd doctor checks are not supported in embedded mode (only bd doctor --check=artifacts, --check=conventions and --check=pollution run there). Recovery means building a new database from a copy of your data that still opens, while keeping the damaged store intact. In releases after v1.3.2, bd doctor --fix backs up or deletes a database only inside the workspace’s .beads directory (a symlinked .beads counts), or at the location BEADS_DOLT_DATA_DIR selects. Automatic integrity recovery and the repo fingerprint fix’s “Reinitialize database” choice refuse a dolt_data_dir or database path that points outside .beads, at .beads itself, or through a symlink, and leave it untouched; recover such a store by hand with the steps below. If bd init fails during automatic recovery and the database location changed meanwhile, bd leaves the backup where it is and prints the path it wrote the backup to; if a directory above the database was replaced, the backup moved with that directory.

1. Stop everything that uses the store

Stop every bd process, agent and script that works in this workspace. In server mode also stop the managed server with bd dolt stop; in shared server mode that server serves every project on the machine, so check what else depends on it first.

2. Preserve the damaged store

Copy the whole store and its configuration before you change anything. Find the store first instead of assuming the default path. bd context --json reads only configuration files, so it answers even when the database will not open. Its beads_dir is the .beads directory bd actually uses: in a git worktree or jj workspace, or behind a .beads/redirect file, it can be another checkout’s.
  • Embedded mode: embeddeddolt/ inside beads_dir.
  • Server mode: dolt/ inside beads_dir by default, or the data_dir that bd context reports (set by dolt_data_dir in metadata.json or by BEADS_DOLT_DATA_DIR). In shared server mode it is ~/.beads/shared-server/dolt/ (or $BEADS_SHARED_SERVER_DIR/dolt/) and holds every project’s database.
Keep the preserved copy outside any server data_dir: the sql-server loads every subdirectory of its data_dir as a database, and a damaged copy there crash-loops it (see re-clone gotchas). Do not delete or edit files inside .dolt/, and do not run Dolt’s data-loss repair (dolt fsck --revive-journal-with-data-loss) on your only copy.

3. Recover into a fresh store

Each route below builds a new database; none repairs the damaged one in place. Run it in a fresh recovery workspace (for example a new clone of the repository), or in this workspace after moving the damaged store out of the way, outside .beads/ and outside any server data_dir:
Pick the newest source you trust. A remote, backup or export holds only what it held when it was made, so a stale source silently drops later work; compare it with what you expect before you rely on it. If you have no recovery source, stop here and keep the preserved copy: it is the only copy of your data. Do not run bd init over it or expect an empty database to bring the issues back. If bd bootstrap or bd init refuses on any route (for example because the remote already has history or the configured server database is missing), follow the recovery playbook for the code it prints rather than forcing it.

From a Dolt remote

Use this when a Dolt remote (sync.remote, or Dolt data on the git origin) is current:
Read the dry-run plan before you run it. It should clone the remote or, with no usable remote, restore .beads/backup/issues.jsonl or import a git-tracked .beads/issues.jsonl. A plan that creates an empty database is not a recovery: stop and use another route. bd dolt pull does not repair a local engine that will not open.

From a Dolt-native backup

Use this only for a Dolt-native backup: the directory you registered with bd backup init and filled with bd backup sync, or an auto-backup snapshot in .beads/backup/ (take it from your preserved copy) or in the backup/ directory inside backup.git-repo. bd backup restore needs an initialized database and does not read a bd export JSONL file, so run it only in an initialized recovery workspace, never over the damaged store:
The engine that reads the backup is the one doing the restore. In embedded mode it is the Dolt engine built into bd, not the Dolt CLI you may have installed. In server mode it is the Dolt SQL server the workspace connects to. A server that bd starts runs the dolt that was on your PATH when it started and keeps that version until it restarts, so after upgrading dolt, restart the server with bd dolt stop and then bd dolt start. Restoring a backup written by the same Dolt version is the baseline; a backup from an older Dolt is the expected direction, within the storage formats Dolt still reads. A backup written by a newer Dolt is not guaranteed to restore, and a dolt backup restore that succeeds with a newer CLI does not show that the engine restoring for bd can read it. If the restore fails with failed to commit restore and Dolt’s table has unknown fields, the engine met table data it does not know, which can mean the backup is in a newer storage format than that engine reads. The restore step had already run, so the workspace may already hold the backup contents, and whether the commit was recorded or the data can be read is unknown. Do not keep working in that workspace, and do not re-run the restore over it hoping for a different result:
  1. Leave the backup directory unchanged; restore from it, never into it.
  2. In embedded mode, upgrade bd to a build whose embedded Dolt can read the backup; in server mode, use a Dolt server whose version can read it. For a server that bd starts, upgrade dolt on your PATH, then run bd dolt stop and bd dolt start so the server runs the upgraded dolt.
  3. Verify in a separate, freshly initialized recovery workspace: run bd init and bd backup restore /path/to/backup --force there, then check the data as described in “4. Verify the recovered data” below before you rely on it.

From a JSONL export

A JSONL file from bd export is an issue export, not a Dolt backup: it has no Dolt history and bd backup restore cannot read it. Keep the original file and import a copy into an initialized recovery workspace:
Or let bd init import it: place a copy under the recovery workspace’s .beads/ and point import.path at it (bd init --from-jsonl reads the configured import.path, issues.jsonl by default, not a filename you pass):

4. Verify the recovered data

Compare the recovered issues with your source, not with a doctor run:
In server mode bd doctor can also check the new database. In embedded mode run only the supported bd doctor --check=... variants.

Prevention

  • Batch repeated writes. bd batch runs a limited set of write commands (close, update, create, dep add, dep remove; see bd batch --help) in one transaction and one bd process, instead of starting the embedded engine once per call. Anything outside that grammar still needs its own bd call.
  • Use a server for sustained concurrent agents. In server or proxied-server mode (bd init --server, bd init --proxied-server) one Dolt server keeps the engine running for every client. Switching an existing workspace is a migration, not a repair.
  • Neither repairs a damaged journal: recover first with Engine won’t open.
  • Keep a current recovery source: push to a Dolt remote (bd dolt push) or take Dolt-native backups (bd backup init <path> once, then bd backup sync).
  • In server mode, use bd dolt stop before system shutdown.