bitcoin-core-app: Assert hit when using a relative datadir path #846

Open
opened 2026-08-06 23:13:50 +00:00 by davidgumberg · 3 comments
davidgumberg commented 2026-08-06 23:13:50 +00:00 (Migrated from github.com)

to reproduce, run bitcoin-core-app with a datadir that has a relative path or a path that includes ~, e.g.:

$ ./build/bin/bitcoin-core-app -datadir=~/altdatadir
bitcoin-core-app: ./util/fs.cpp:34: fs::path fsbridge::AbsPathJoin(const fs::path&, const fs::path&): Assertion `base.is_absolute()' failed.
Aborted                    (core dumped) ./build/bin/bitcoin-core-app -datadir=~/altdatadir
to reproduce, run bitcoin-core-app with a datadir that has a relative path or a path that includes `~`, e.g.: ```console $ ./build/bin/bitcoin-core-app -datadir=~/altdatadir bitcoin-core-app: ./util/fs.cpp:34: fs::path fsbridge::AbsPathJoin(const fs::path&, const fs::path&): Assertion `base.is_absolute()' failed. Aborted (core dumped) ./build/bin/bitcoin-core-app -datadir=~/altdatadir ```
hebasto commented 2026-08-07 10:54:05 +00:00 (Migrated from github.com)

FWIW, bitcoind / bitcoin-qt process paths with ~ differently:

$ stat ~/altdatadir
  File: /home/hebasto/altdatadir
  size: 3         	Blocks: 2          IO Block: 131072 directory
Device: 0,49	Inode: 8811742     Links: 3
Access: (0775/drwxrwxr-x)  Uid: ( 1000/ hebasto)   Gid: ( 1000/ hebasto)
Access: 2026-08-07 11:48:35.122370521 +0100
Modify: 2026-08-07 11:49:57.511690386 +0100
Change: 2026-08-07 11:49:57.511690386 +0100
 Birth: 2026-08-07 11:48:34.095366774 +0100
$ ./build_dev_mode/bin/bitcoind -datadir=~/altdatadir
Error: Specified data directory "~/altdatadir" does not exist.
$ ./build_dev_mode/bin/bitcoin-qt -datadir=~/altdatadir
Error: Specified data directory "~/altdatadir" does not exist.
FWIW, `bitcoind` / `bitcoin-qt` process paths with `~` differently: ```console $ stat ~/altdatadir File: /home/hebasto/altdatadir size: 3 Blocks: 2 IO Block: 131072 directory Device: 0,49 Inode: 8811742 Links: 3 Access: (0775/drwxrwxr-x) Uid: ( 1000/ hebasto) Gid: ( 1000/ hebasto) Access: 2026-08-07 11:48:35.122370521 +0100 Modify: 2026-08-07 11:49:57.511690386 +0100 Change: 2026-08-07 11:49:57.511690386 +0100 Birth: 2026-08-07 11:48:34.095366774 +0100 $ ./build_dev_mode/bin/bitcoind -datadir=~/altdatadir Error: Specified data directory "~/altdatadir" does not exist. $ ./build_dev_mode/bin/bitcoin-qt -datadir=~/altdatadir Error: Specified data directory "~/altdatadir" does not exist.
davidgumberg commented 2026-08-07 21:29:19 +00:00 (Migrated from github.com)

Yeah, maybe this shouldn't be supported, but it should not hit an assert.

Yeah, maybe this shouldn't be supported, but it should not hit an assert.
jarolrod commented 2026-11-05 18:04:57 +00:00 (Migrated from github.com)

I reproduced two additional unavailable-data-directory cases on qt6 at d567e3eb2497, macOS / Qt 6.9.0.

Missing absolute paths also trigger the assertion. Launching with -datadir=/Volumes/unavailable-drive/Bitcoin, where that directory does not exist, aborts with assert(base.is_absolute()) before a window appears. A missing relative path does the same. With the same argument, bitcoind reports that the specified data directory does not exist and exits normally with an error.

The QML pre-init config read reaches AbsPathJoin with an empty path before normal startup checks the explicit -datadir. This extends the reproduction beyond relative-path or ~ handling.

A missing directory selected by bitcoin.conf produces a different recovery failure. Put datadir=/Volumes/unavailable-drive/Bitcoin in the default bitcoin.conf, then launch without -datadir:

  1. The first-run wizard appears, including when -qml_onboarded=1 is supplied, with the missing-directory error at the bottom.
  2. Keep Default for storage. On Storage amount, Next remains disabled.
  3. Selecting another existing directory through Custom clears the error and allows startup using that directory. It also saves a GUI data-directory selection that takes precedence on later launches.

Closing the app, making the original directory available, and relaunching recovers without changing the selection. The missing drive was simulated with a nonexistent path; the Custom selection was exercised through the test bridge. No existing wallet or chain data was moved or deleted.

PR #883 already targets this issue. Its current head, 8e5b4d1f090a, adds early explicit-path validation and changes configured-directory recovery. I inspected that source but have not run these cases against the PR. These are additional reproduction cases to cover while reviewing it, rather than a claim that the PR still fails them.

The recovery flow should identify the unavailable configured directory and let the user quit or retry after reconnecting it. Continuing with a different directory should be an explicit choice, without leaving Default at a disabled Next button.

I reproduced two additional unavailable-data-directory cases on `qt6` at `d567e3eb2497`, macOS / Qt 6.9.0. **Missing absolute paths also trigger the assertion.** Launching with `-datadir=/Volumes/unavailable-drive/Bitcoin`, where that directory does not exist, aborts with `assert(base.is_absolute())` before a window appears. A missing relative path does the same. With the same argument, `bitcoind` reports that the specified data directory does not exist and exits normally with an error. The QML pre-init config read reaches `AbsPathJoin` with an empty path before normal startup checks the explicit `-datadir`. This extends the reproduction beyond relative-path or `~` handling. **A missing directory selected by bitcoin.conf produces a different recovery failure.** Put `datadir=/Volumes/unavailable-drive/Bitcoin` in the default `bitcoin.conf`, then launch without `-datadir`: 1. The first-run wizard appears, including when `-qml_onboarded=1` is supplied, with the missing-directory error at the bottom. 2. Keep **Default** for storage. On **Storage amount**, Next remains disabled. 3. Selecting another existing directory through **Custom** clears the error and allows startup using that directory. It also saves a GUI data-directory selection that takes precedence on later launches. Closing the app, making the original directory available, and relaunching recovers without changing the selection. The missing drive was simulated with a nonexistent path; the Custom selection was exercised through the test bridge. No existing wallet or chain data was moved or deleted. [PR #883](https://github.com/bitcoin-core/gui-qml/pull/883) already targets this issue. Its current head, `8e5b4d1f090a`, adds early explicit-path validation and changes configured-directory recovery. I inspected that source but have not run these cases against the PR. These are additional reproduction cases to cover while reviewing it, rather than a claim that the PR still fails them. The recovery flow should identify the unavailable configured directory and let the user quit or retry after reconnecting it. Continuing with a different directory should be an explicit choice, without leaving Default at a disabled Next button.
Sign in to join this conversation.
No description provided.