{"record":{"id":"e377db287aec3a0e","repo":"BloopAI/vibe-kanban","slug":"failed-to-install-rustls-crypto-provider-e377db","errorCode":null,"errorMessage":"Failed to install rustls crypto provider","messagePattern":"Failed to install rustls crypto provider","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tauri-app/src/main.rs","lineNumber":116,"sourceCode":"        // Fallback: tauri-plugin-notification (no click handling).\n        if let Err(e) = self\n            .app_handle\n            .notification()\n            .builder()\n            .title(title)\n            .body(message)\n            .show()\n        {\n            tracing::warn!(\"Failed to send Tauri notification: {}\", e);\n        }\n    }\n}\n\nfn main() {\n    // Install rustls crypto provider before any TLS operations\n    rustls::crypto::aws_lc_rs::default_provider()\n        .install_default()\n        .expect(\"Failed to install rustls crypto provider\");\n\n    let log_level = std::env::var(\"RUST_LOG\").unwrap_or_else(|_| \"info\".to_string());\n    let filter_string = format!(\n        \"warn,server={level},services={level},db={level},executors={level},deployment={level},local_deployment={level},utils={level},vibe_kanban_tauri={level}\",\n        level = log_level\n    );\n    let env_filter = EnvFilter::try_new(filter_string).expect(\"Failed to create tracing filter\");\n\n    sentry_utils::init_once(SentrySource::Desktop);\n\n    tracing_subscriber::registry()\n        .with(tracing_subscriber::fmt::layer().with_filter(env_filter))\n        .with(sentry_layer())\n        .init();\n\n    // Shared token so we can tell the server to shut down when the app quits.\n    let shutdown_token = Arc::new(CancellationToken::new());\n    let shutdown_token_for_event = shutdown_token.clone();","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/tauri-app/src/main.rs#L98-L134","documentation":"`rustls::crypto::CryptoProvider::install_default()` panics via `.expect()` when the process-wide default crypto provider cannot be installed. rustls (>=0.23) requires exactly one default provider; installation fails if a default provider was already installed earlier in the process, or if no provider feature (aws-lc-rs/ring) is enabled in the compiled rustls. In a Tauri app this runs first in main, before any TLS.","triggerScenarios":"Calling `main()` in a process where another dependency (or a prior call) already called install_default(); or a build where multiple/incompatible provider features or none are enabled for rustls; loading the app in test harnesses that initialize rustls twice.","commonSituations":"Two dependencies pulling rustls with different providers; running the tauri binary inside tests that also install a provider; feature-flag changes after a Cargo.toml dependency update causing no-provider builds.","solutions":["Guard installation: use `rustls::crypto::aws_lc_rs::default_provider().try_install().ok();` or check `rustls::crypto::CryptoProvider::get_default().is_none()` before installing.","Ensure exactly one provider feature is enabled: use rustls with the `aws-lc-rs` feature consistently across the dependency tree (`cargo tree -i rustls`).","If initialization may run twice (tests, re-entry), move install into a std::sync::Once / once_cell lazy static.","Update conflicting dependencies so only one rustls version/provider is compiled in."],"exampleFix":"// before\nrustls::crypto::aws_lc_rs::default_provider()\n    .install_default()\n    .expect(\"Failed to install rustls crypto provider\");\n// after\nif rustls::crypto::CryptoProvider::get_default().is_none() {\n    let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();\n}","handlingStrategy":"fallback","validationCode":"// Check before installing\nif rustls::crypto::CryptoProvider::get_default().is_none() {\n    rustls::crypto::aws_lc_rs::default_provider().install_default().ok();\n}","typeGuard":"fn provider_installed() -> bool {\n    rustls::crypto::CryptoProvider::get_default().is_some()\n}","tryCatchPattern":"// Use the Result-returning API instead of expect:\nif let Err(e) = rustls::crypto::aws_lc_rs::default_provider().install_default() {\n    eprintln!(\"rustls provider install skipped: {e}\"); // another provider already active\n}","preventionTips":["Wrap one-time process setup (provider install, subscriber init) in std::sync::Once.","Enable exactly one rustls provider feature across the workspace and audit with `cargo tree -i rustls`.","Never assume main() runs only once in tests; use try_install and ignore AlreadyInstalled.","Keep tauri/rustls/reqwest dependency versions in sync after upgrades."],"tags":["rust","rustls","tls","startup","crypto-provider"],"backgroundTag":"rustls-crypto-provider-already-installed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}