Improve settings.json error message to mention full disk as possible cause #35373

issue sys-dev opened this issue on May 25, 2026
  1. sys-dev commented at 6:16 PM on May 25, 2026: none

    Motivation

    When a full disk causes settings.json to be zero-written, Bitcoin Core reports:

    "This is probably caused by disk corruption or a crash"

    A full disk is a common real-world cause of this exact failure — the file exists but contains zero bytes, producing invalid JSON. The current message does not mention this possibility, leading users to investigate hardware corruption and crashes when the actual cause is simply insufficient disk space.

    Possible solution

    Change the error message from:

    "This is probably caused by disk corruption or a crash"

    to:

    "This is probably caused by a full disk, disk corruption or a crash"

    One-line change in src/util/settings.cpp

    Useful Skills

    • Compiling Bitcoin Core from source
    • Running the C++ unit tests and the Python functional tests
    • ...

    Guidance for new contributors

    Want to work on this issue?

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  2. sys-dev added the label good first issue on May 25, 2026
  3. sh011 commented at 6:59 PM on May 25, 2026: none

    Hi, I have started working on this as my first issue. Thanks!

  4. sys-dev commented at 1:54 AM on May 26, 2026: none

    glad the hear! here are the full log entries that occurred:

    bitcoind | Error: Settings file could not be read: bitcoind | - Settings file /home/bitcoin/.bitcoin/settings.json does not contain valid JSON. This is probably caused by disk corruption or a crash, and can be fixed by removing the file, which will reset settings to default values.

  5. sh011 referenced this in commit af44551cf0 on May 26, 2026
  6. achow101 commented at 9:58 PM on May 27, 2026: member

    In what way does adding to this error message make it easier to debug the issue? If the disk is full, a ton of other things will fail first, and at least one of those should indicate that the failure is caused by a lack of disk space.

  7. achow101 removed the label good first issue on May 27, 2026
  8. sys-dev commented at 11:07 PM on May 27, 2026: none

    hello @achow101,

    Since other messages or clues to the disk being full are not nearby, it doesn't come to mind. The hint directly within this message itself would very much help an operator recognize it as an additional possibility. Is a full disk not also a probable cause?

  9. achow101 commented at 11:41 PM on May 27, 2026: member

    Can you provide an actual debug.log that demonstrates how this would be more useful?

  10. sys-dev commented at 1:14 AM on May 28, 2026: none

    yes, I'll set it up again, reproduce the scenario and share the debug.log afterwards.

  11. sh011 referenced this in commit f702d0696f on May 28, 2026
  12. sh011 referenced this in commit e23c59acea on May 28, 2026
  13. sh011 referenced this in commit 27d51d1bf3 on May 28, 2026
  14. sys-dev commented at 6:01 PM on May 28, 2026: none

    I setup the same scenario by re-installing the host OS Ubuntu 24.04 LTS and left default LV settings which only allocate 100G to /

    during IBD, the disk filled. log result this time:

    2026-05-28T16:44:49Z UpdateTip: new best=000000000000000002a2e1ddc345b9fe700aa572274cb42e2ebd0a47e7cab403 height=381767 version=0x00000003 log2_work=83.551296 tx=90610866 date='2015-11-02T22:18:41Z' progress=0.066692 cache=1169.5MiB(8771598txo) 2026-05-28T16:44:50Z UpdateTip: new best=00000000000000000ed211b270583c6235f0ecf14611c94a5719ca69dfa81065 height=381768 version=0x00000003 log2_work=83.551323 tx=90612084 date='2015-11-02T22:30:06Z' progress=0.066693 cache=1169.5MiB(8771797txo) 2026-05-28T16:44:50Z UpdateTip: new best=000000000000000005aa0211fe4903d88391654976ae66ff94994769eb739460 height=381769 version=0x00000003 log2_work=83.551350 tx=90614091 date='2015-11-02T22:47:19Z' progress=0.066694 cache=1169.5MiB(8772360txo) 2026-05-28T16:44:50Z [error] Fatal LevelDB error: IO error: /home/bitcoin/.bitcoin/indexes/txindex/001968.log: No space left on device 2026-05-28T16:44:50Z You can use -debug=leveldb to get more complete diagnostic messages 2026-05-28T16:44:50Z [warning]

    In my original experience of the failure, the above "No space left on device" error message didn't appear.

    I suspect there's a race condition where the "Error: Settings file could not be read" message can sometimes be emitted instead.

    In this recent run, the settings file /home/bitcoin/.bitcoin/settings.json is present, but has again been zeroed. I assume it gets zeroed asynchronously and this can result in a race condition as to which error output is emitted.

    It would be helpful if the "Error: Settings file could not be read" message could give hint about possibility of a full disk in case it's the one emitted.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-31 17:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me