{"record":{"id":"6feab335f5cb59a8","repo":"vectordotdev/vector","slug":"unable-to-create-async-runtime","errorCode":null,"errorMessage":"Unable to create async runtime","messagePattern":"Unable to create async runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/app.rs","lineNumber":606,"sourceCode":"        return Err(exitcode::CONFIG);\n    };\n    let Some(ready_array_capacity) =\n        chunk_size_events.checked_mul(crate::topology::builder::READY_ARRAY_CAPACITY_CHUNKS)\n    else {\n        error!(\"The `chunk_size_events` argument is too large.\");\n        return Err(exitcode::CONFIG);\n    };\n\n    vector_lib::source_sender::set_chunk_size_events(chunk_size_events);\n    crate::topology::builder::set_source_sender_buffer_size(source_sender_buffer_size);\n    crate::topology::builder::set_ready_array_capacity(ready_array_capacity);\n\n    debug!(\n        message = \"Building runtime.\",\n        worker_threads = threads,\n        chunk_size_events\n    );\n    Ok(rt_builder.build().expect(\"Unable to create async runtime\"))\n}\n\npub async fn load_configs(\n    config_paths: &[ConfigPath],\n    watcher_conf: Option<config::watcher::WatcherConfig>,\n    require_healthy: Option<bool>,\n    allow_empty_config: bool,\n    graceful_shutdown_duration: Option<Duration>,\n    signal_handler: &mut SignalHandler,\n) -> Result<Config, ExitCode> {\n    let config_paths = config::process_paths(config_paths).ok_or(exitcode::CONFIG)?;\n\n    let watched_paths = config_paths\n        .iter()\n        .map(<&PathBuf>::from)\n        .collect::<Vec<_>>();\n\n    info!(","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/src/app.rs#L588-L624","documentation":"app::build_runtime (src/app.rs) configures a multi-threaded tokio runtime (max_blocking_threads(20_000), enable_all, worker_threads = threads) and calls rt_builder.build().expect(\"Unable to create async runtime\"). tokio's Builder::build panics when runtime resources cannot be created — most commonly failure to register the IO/time drivers (epoll/timerfd creation hitting the file-descriptor limit), or OS thread/resource exhaustion — which this expect re-raises at Vector startup.","triggerScenarios":"Starting Vector in an environment where the async runtime cannot be constructed: process file-descriptor limit (ulimit -n) too low to create the epoll/timer FDs for the IO and time drivers; cgroup/container pids.max or memory limits preventing thread creation; a sandbox/seccomp profile blocking epoll_create1/timerfd_create. Threads == 0 is caught earlier with a CONFIG exit, so this panic is environmental rather than a bad --threads flag.","commonSituations":"Containers/systemd units with low LimitNOFILE (e.g. 1024) plus many sources/sinks; Kubernetes pods with tight pids limits; gVisor/seccomp-restricted sandboxes; heavily loaded hosts during process start.","solutions":["Raise the FD limit before starting Vector: ulimit -n 65535 (or LimitNOFILE=65535 in the systemd unit, or a container runtime default), then retry","Check thread/pid headroom: cat /proc/sys/kernel/pids_max, the cgroup pids.max, and container memory limits; relax if Vector cannot spawn worker threads","If running under a restrictive sandbox, allow epoll_create1, eventfd and timerfd_create syscalls","Verify with a minimal run: RUST_BACKTRACE=1 vector --config minimal.yaml to capture which driver failed, and check dmesg/audit for blocked syscalls"],"exampleFix":"# before (systemd unit)\n[Service]\nExecStart=/usr/bin/vector --config /etc/vector/vector.yaml\n\n# after\n[Service]\nLimitNOFILE=65535\nExecStart=/usr/bin/vector --config /etc/vector/vector.yaml","handlingStrategy":"validation","validationCode":"// Pre-flight check before build_runtime: ensure FD headroom for the IO/time drivers\nlet fd_limit = std::fs::read_to_string(\"/proc/self/limits\").ok().and_then(|s| {\n    s.lines().find(|l| l.starts_with(\"Max open files\")).and_then(|l| {\n        l.split_whitespace().nth(3).and_then(|v| v.parse::<usize>().ok())\n    })\n});\nassert!(fd_limit.unwrap_or(0) > 1024, \"raise ulimit -n before starting Vector\");","typeGuard":null,"tryCatchPattern":"// Wrap startup so a runtime-build panic degrades to a clear exit, not a crash dump\nlet rt = std::panic::catch_unwind(|| app::build_runtime(threads, chunk, \"vector\"))\n    .map_err(|_| \"async runtime creation failed: check ulimit -n / cgroup pids limits\")?;","preventionTips":["Set LimitNOFILE=65535 (systemd) or a high ulimit -n in containers","Ensure cgroup pids.max and memory limits allow worker threads + 20k blocking threads","Allow epoll_create1/eventfd/timerfd_create in seccomp profiles","Capture RUST_BACKTRACE=1 output to identify which driver failed"],"tags":["vector","tokio","async-runtime","startup","file-descriptors","container-limits","panic"],"backgroundTag":"runtime-initialization-failed","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}