fix: strip the legacy auth key from electrs.toml - #79
Merged
Conversation
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
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Electrs fails to start after an update from StartOS 0.3.5.1:
The 0.3.5.1 package wrote
electrs.tomlfrom a Rust configurator template that opened withauth = "<rpcuser>:<rpcpass>". That file lives at the root of themainvolume, which survives the update. Every write path here isFileHelper.merge, which preserves keys the shape doesn't name, soauthstayed put whilecookie_filewas 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 intov0.11.1_9.tschanged it tomerge, so the collision came back for anyone updating from 0.3.5.1 onto :10 or later.Declaring
authin the shape makes it a keymergeowns, 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
authline.start-cli package attach electrs -n electrs -- cat /data/electrs.tomlshows both anauth = …line andcookie_file = "/mnt/bitcoind/.cookie", and the service logs end withambiguous configuration.authline is gone,cookie_fileremains, andlog_filters/index_batch_size/index_lookup_limitkeep the values they had.authline does not come back.Verified so far:
tsc --noEmit, plus a round trip of a legacy 0.3.5.1electrs.tomlthrough the SDK's ownz.deepLoose/fileMerge/TOML.stringify(dropsauth, keeps everything else, idempotent on re-merge). Not yet installed on a box.🤖 Generated with Claude Code