Skip to content

fix: strip the legacy auth key from electrs.toml - #79

Merged
MattDHill merged 1 commit into
masterfrom
fix/strip-legacy-auth
Jul 25, 2026
Merged

fix: strip the legacy auth key from electrs.toml#79
MattDHill merged 1 commit into
masterfrom
fix/strip-legacy-auth

Conversation

@helix-nine

Copy link
Copy Markdown

Electrs fails to start after an update from StartOS 0.3.5.1:

health check Electrs failed: Electrs Daemon crashed
Error: ambiguous configuration - auth and cookie_file can't be specified at the same time

The 0.3.5.1 package wrote electrs.toml from a Rust configurator template that opened with auth = "<rpcuser>:<rpcpass>". That file lives at the root of the main volume, which survives the update. Every write path here is FileHelper.merge, which preserves keys the shape doesn't name, so auth stayed put while cookie_file was filled in from its .catch() default — and electrs rejects both at once (electrs/src/config.rs, match (config.auth, config.cookie_file)).

Through 0.11.1:8 the migration used tomlFile.write(), a whole-file replacement that dropped the key. Freezing it into v0.11.1_9.ts changed it to merge, so the collision came back for anyone updating from 0.3.5.1 onto :10 or later.

Declaring auth in the shape makes it a key merge owns, so validation coerces it away on every write path — seedFiles, main, the config action — rather than only along one migration edge. A 0.3.5.1 backup restored onto 0.4.0 is covered too.

Test plan

Only useful on a node that came from StartOS 0.3.5.1 with electrs installed — a fresh install never had an auth line.

  1. Confirm the bad state on a node currently failing: start-cli package attach electrs -n electrs -- cat /data/electrs.toml shows both an auth = … line and cookie_file = "/mnt/bitcoind/.cookie", and the service logs end with ambiguous configuration.
  2. Install this build and start electrs.
  3. Re-read the config — the auth line is gone, cookie_file remains, and log_filters / index_batch_size / index_lookup_limit keep the values they had.
  4. Electrs reaches "Electrum server is ready and accepting connections", and the index resumes rather than rebuilding.
  5. Run Configure, change the log level, save — the auth line does not come back.

Verified so far: tsc --noEmit, plus a round trip of a legacy 0.3.5.1 electrs.toml through the SDK's own z.deepLoose / fileMerge / TOML.stringify (drops auth, keeps everything else, idempotent on re-merge). Not yet installed on a box.

🤖 Generated with Claude Code

Configs carried over from StartOS 0.3.5.1 still carry the old configurator's
`auth = "<user>:<pass>"` line, and merge preserves keys the shape doesn't name.
electrs saw auth alongside cookie_file and exited with "ambiguous
configuration", failing its health check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@MattDHill
MattDHill merged commit 282b8ae into master Jul 25, 2026
1 check passed
@MattDHill
MattDHill deleted the fix/strip-legacy-auth branch July 25, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants