Skip to content

Document rustls-no-provider initialization requirement #2924

@clouatre

Description

@clouatre

Problem

Using rustls-no-provider causes a runtime panic if the crypto provider isn't manually initialized:

thread 'main' panicked at reqwest-0.13.1/src/async_impl/client.rs:2450:5:
No provider set

This requirement is not documented in the README or migration guide.

Reproduction

reqwest = { version = "0.13", features = ["rustls-no-provider"] }
rustls = { version = "0.23", features = ["ring"] }
#[tokio::main]
async fn main() {
    let client = reqwest::Client::new(); // panics here
}

Current Workaround

Initialize the provider before creating clients:

#[tokio::main]
async fn main() {
    rustls::crypto::ring::default_provider()
        .install_default()
        .expect("Failed to install rustls crypto provider");
    
    let client = reqwest::Client::new(); // now works
}

Suggested Solutions

Option 1: Better Error Message (Easy)

Change the panic message to include initialization instructions:

No rustls crypto provider set. When using rustls-no-provider, you must call:
  rustls::crypto::ring::default_provider().install_default()
before creating any reqwest clients.

Option 2: Convenience Features (Medium)

Add features that handle initialization automatically:

  • rustls-ring - uses ring provider with auto-init
  • rustls-aws-lc - uses aws-lc-rs provider with auto-init

This would make migration from 0.12 smoother.

Option 3: Documentation (Easy)

Add to README under TLS backends section:

### Using `rustls-no-provider`

To use a specific crypto provider (e.g., `ring` instead of default `aws-lc-rs`):

```toml
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider"] }
rustls = { version = "0.23", features = ["ring"] }
```

**Required:** Initialize the provider before creating any clients:

```rust
rustls::crypto::ring::default_provider()
    .install_default()
    .expect("Failed to install rustls crypto provider");
```

⚠️ Forgetting this will cause a runtime panic.

Context

  • reqwest 0.12 with rustls-tls worked without manual initialization
  • 0.13.0 released Dec 30, 2025 (yesterday)
  • Affects users avoiding aws-lc-rs for binary size or build simplicity

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tlsArea: Transport Layer SecurityE-easyEffort: Easy! Start here :DE-pr-welcomeThe feature is welcome to be added, instruction should be found in the issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions