sxyazi/yazi · error
Failed to install ring crypto provider
Error message
Failed to install ring crypto provider
What it means
yazi-shim initializes rustls by installing the `ring` crate's crypto provider as the process-wide default via `install_default()`. This function returns Err if a default provider was already installed (or installation raced with another thread), so the shim maps that failure to this anyhow error.
Solutions
- Ensure the shim's init() runs exactly once at startup, before anything else installs a provider
- Standardize on one crypto provider (ring OR aws-lc-rs) across all dependencies
- Make init idempotent: ignore AlreadyInstalled errors instead of failing
- Check dependency features that pull in an alternative rustls crypto provider
Example fix
// before
::rustls::crypto::ring::default_provider()
.install_default()
.map_err(|_| anyhow!("Failed to install ring crypto provider"))
// after
let _ = ::rustls::crypto::ring::default_provider().install_default(); // tolerate already-installed
Ok(()) Defensive patterns
Strategy: try-catch
Try / catch
match init_result {
Err(e) if e.to_string().contains("Failed to install ring crypto provider") => {
// A provider is likely already installed — treat as success
}
other => other,
} Prevention
- Call init once at program startup, before any TLS use
- Don't mix ring and aws-lc-rs provider features in one binary
- Make provider installation idempotent (ignore AlreadyInstalled)
- Audit dependency features that install their own rustls provider
When it happens
Trigger: `rustls::crypto::ring::default_provider().install_default()` returns Err — most commonly because another part of the program (another shim, aws-lc-rs, or a dependency) already called `install_default()` earlier in the same process.
Common situations: Applications linking multiple TLS stacks (e.g. both yazi-shim/rustls+ring and aws-lc-rs based crates); calling this init twice; multithreaded startup where two components race to install a provider.
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/80ec27fa82e86be2.
Report an issue: GitHub.
Appendix: source
Thrown at yazi-shim/src/rustls.rs:6
use anyhow::anyhow;
pub(super) fn init() -> anyhow::Result<()> {
::rustls::crypto::ring::default_provider()
.install_default()
.map_err(|_| anyhow!("Failed to install ring crypto provider"))
}
View on GitHub (pinned to 5f901b886b)