{"record":{"id":"f29986f6b738c806","repo":"block/buzz","slug":"failed-to-build-tokio-runtime-error","errorCode":null,"errorMessage":"failed to build Tokio runtime: {error}","messagePattern":"failed to build Tokio runtime: (.+?)","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/buzz-relay/src/main.rs","lineNumber":114,"sourceCode":"                EmissionScope::All\n            }\n        }\n    }\n\n    fn allows(&self, _community_id: &Uuid) -> bool {\n        matches!(self, Self::All)\n    }\n}\n\nconst USAGE_METRICS_LOCK_KEY: i64 = 0x4255_5A5A_4D45_5452;\n\nfn main() -> anyhow::Result<()> {\n    let (runtime, boot) = BootTracker::start_before_runtime(|| {\n        tokio::runtime::Builder::new_multi_thread()\n            .enable_all()\n            .build()\n    })\n    .map_err(|error| anyhow::anyhow!(\"failed to build Tokio runtime: {error}\"))?;\n    runtime.block_on(run_relay_main(boot))\n}\n\nasync fn run_relay_main(boot: BootTracker) -> anyhow::Result<()> {\n    // Install the ring CryptoProvider for rustls. Required before any rustls\n    // TLS connection (rediss:// to ElastiCache, wss://, S3 over TLS): both\n    // aws-lc-rs and ring are compiled in transitively, so rustls can't\n    // auto-select a provider and would panic at first use without this.\n    let (mut boot, ()) = boot\n        .run_required(\n            StartupPhase::CryptoInit,\n            || {\n                rustls::crypto::ring::default_provider()\n                    .install_default()\n                    .map_err(|_provider| ())\n            },\n            |_error| LifecycleReason::ProviderConflict,\n        )","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-relay/src/main.rs#L96-L132","documentation":"Raised in main when tokio::runtime::Builder::new_multi_thread().enable_all().build() fails, meaning the multi-threaded Tokio runtime could not be created before any relay startup work begins. This is a fatal, pre-boot failure — typically caused by OS resource limits (thread creation failure, insufficient memory) — and the error is wrapped via BootTracker so startup telemetry records the failure before the process exits with the anyhow error.","triggerScenarios":"Thrown at crates/buzz-relay/src/main.rs:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Free system memory or raise the thread/process resource limits (ulimit) that prevented Tokio from spawning worker threads","Retry on a machine with adequate resources; the failure is environmental, not a configuration bug","Check kernel logs for thread-allocation failures if the error persists"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-09-05T18:13:50.666Z","contentChangedAt":"2026-09-05T18:13:50.666Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}