{"record":{"id":"9750fece48ea38da","repo":"gleam-lang/gleam","slug":"unable-to-start-tokio-async-runtime-9750fe","errorCode":null,"errorMessage":"Unable to start Tokio async runtime","messagePattern":"Unable to start Tokio async runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler-cli/src/docs.rs","lineNumber":25,"sourceCode":"use ecow::EcoString;\n\nuse crate::{cli, fs::ProjectIO, http::HttpClient};\nuse gleam_core::{\n    Result,\n    analyse::TargetSupport,\n    build::{Codegen, Compile, Mode, Options, Package, Target},\n    config::{DocsPage, PackageConfig},\n    docs::{Dependency, DependencyKind, DocContext},\n    error::Error,\n    hex,\n    io::HttpClient as _,\n    manifest::ManifestPackageSource,\n    paths::ProjectPaths,\n    type_,\n};\n\npub fn remove(package: String, version: String) -> Result<()> {\n    let runtime = tokio::runtime::Runtime::new().expect(\"Unable to start Tokio async runtime\");\n    let http = HttpClient::new();\n    let hex_config = hexpm::Config::new();\n    let credentials = crate::hex::HexAuthentication::new(&runtime, &http, hex_config.clone())\n        .get_or_create_api_credentials()?;\n\n    // Remove docs from API\n    let request = hexpm::api_remove_docs_request(\n        &package,\n        &version,\n        &crate::hex::write_credentials(&credentials)?,\n        &hex_config,\n    )\n    .map_err(Error::hex)?;\n    let response = runtime.block_on(http.send(request))?;\n    hexpm::api_remove_docs_response(response).map_err(Error::hex)?;\n\n    // Done!\n    println!(\"The docs for {package} {version} have been removed from HexDocs\");","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/gleam-lang/gleam/blob/7e623aa83da3776faee50ca4ab9a6c40124acd95/compiler-cli/src/docs.rs#L7-L43","documentation":"`gleam docs remove` (compiler-cli/src/docs.rs:25) builds a Tokio runtime to authenticate with Hex and send the docs-removal API request. `tokio::runtime::Runtime::new()` fails when the OS denies worker-thread creation or the epoll/timerfds for its drivers; `.expect(\"Unable to start Tokio async runtime\")` then panics, aborting the command before credentials are even read.","triggerScenarios":"Running `gleam docs remove --package <name> --version <ver>` on a host where `Runtime::new()` cannot be built: thread/process limits (`ulimit -u`, cgroup pids.max), fd exhaustion (EMFILE), no memory for thread stacks, or a seccomp profile blocking `clone`/`epoll_create1`.","commonSituations":"Release automation in tightly capped containers (`--pids-limit`, low nofile); CI images with dozens of concurrent jobs exhausting the process limit; hardened runners denying eventfd/epoll syscalls.","solutions":["Raise `ulimit -u`/pids limits so Tokio can spawn its worker pool","Raise `ulimit -n` (e.g. 4096) and clear fd leaks","Add memory headroom or raise the container memory cap","Permit `clone`/`epoll_create1`/`eventfd`/`timerfd_*` in custom seccomp","Retry `gleam docs remove` once the environment allows a runtime"],"exampleFix":"# before: panics at startup\ndocker run --pids-limit 16 ci gleam docs remove --package mypkg --version 1.0.0\n\n# after: adequate pids headroom\ndocker run --pids-limit 512 ci gleam docs remove --package mypkg --version 1.0.0","handlingStrategy":"validation","validationCode":"# before running docs removal in automation\nulimit -n 4096\ngleam docs remove --package \"$PKG\" --version \"$VER\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run docs-maintenance commands in containers with default (not minimal-capped) limits","Keep release containers on standard images that mount /proc and allow epoll"],"tags":["gleam","tokio","async-runtime","docs","hex","resource-limits"],"backgroundTag":"tokio-runtime-start-failed","analyzedSha":"7e623aa83da3776faee50ca4ab9a6c40124acd95","analyzedAt":"2026-08-17T00:07:02.091Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}