Skip to content

rustls 0.23 CryptoProvider panic on Mattermost wss:// connection #903

@JYeswak

Description

@JYeswak

Problem

Any TLS connection (specifically the Mattermost channel adapter's wss:// WebSocket) causes a tokio worker thread panic:

thread 'tokio-rt-worker' panicked at rustls-0.23.37/src/crypto/mod.rs:249:14:

Could not automatically determine the process-level CryptoProvider from Rustls crate features.
Call CryptoProvider::install_default() before this point to select a provider manually,
or make sure exactly one of the 'aws-lc-rs' and 'ring' features is enabled.

After enough panics accumulate (~50), the process exits. This happens on every startup when [channels.mattermost] is configured with an https:// server URL.

Environment

  • v0.5.4 and v0.5.5 Linux x86_64 binaries (both affected)
  • Docker on Ubuntu 22.04
  • Config has [channels.mattermost] with server_url = "https://chat.example.com"

Root cause

Cargo.toml uses rustls-tls feature for reqwest and rustls-tls-native-roots for tokio-tungstenite, but rustls 0.23+ requires an explicit CryptoProvider to be installed before any TLS operations. The binary doesn't call CryptoProvider::install_default() at startup.

Suggested fix

Add this early in main(), before any async runtime or TLS connections:

rustls::crypto::ring::default_provider().install_default().ok();

Or ensure the ring crate feature is enabled for rustls in Cargo.toml so it auto-installs.

Workaround

Remove [channels.mattermost] from config.toml entirely. This disables native Mattermost DM-to-agent chat but avoids the panic. Slash commands via an external bridge still work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions