Skip to content

fix: return Result from VersionChecker::new instead of panicking on TLS init failure#2093

Open
amathxbt wants to merge 1 commit into
nexus-xyz:mainfrom
amathxbt:fix/version-checker-panic
Open

fix: return Result from VersionChecker::new instead of panicking on TLS init failure#2093
amathxbt wants to merge 1 commit into
nexus-xyz:mainfrom
amathxbt:fix/version-checker-panic

Conversation

@amathxbt
Copy link
Copy Markdown

@amathxbt amathxbt commented May 7, 2026

Problem

VersionChecker::new calls .expect() on the reqwest::ClientBuilder::build() result:

.build()
.expect("Failed to create HTTP client for version checker")

ClientBuilder::build can fail when the TLS backend cannot be initialised — for example in minimal container images without system CA certificates, or in FIPS-restricted environments. The expect turns this initialisation error into an unconditional process abort, preventing the CLI from starting at all even though the version check is entirely optional.

Fix

Change new to new(current_version: String) -> Result<Self, reqwest::Error> and propagate the error with ?. Update check_for_new_version to treat a new failure as non-fatal (return None rather than crashing).

ClientBuilder::build() can fail when the TLS stack is unavailable (certain
minimal container images, FIPS-restricted environments, or broken system
rootcas). The current code calls .expect() which terminates the entire CLI
process before the user can do anything useful.

Change new() to return Result<Self, reqwest::Error> and update
check_for_new_version to treat a construction failure as non-fatal,
returning None (no update message) instead of crashing.
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.

1 participant