{"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/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/app.rs#L588-L624","documentation":"Vector's `build_runtime` constructs the tokio async runtime via a `RuntimeBuilder` (with configured worker threads and event chunk size) and panics if `rt_builder.build()` fails. Runtime construction fails on invalid thread counts or OS resource limits (e.g. cannot spawn worker threads), so Vector treats it as an unrecoverable startup error.","triggerScenarios":"Starting Vector with `--threads N` where the OS cannot spawn N worker threads (RLIMIT_NPROC limits, huge thread counts), or a tokio builder misconfiguration.","commonSituations":"Running in restricted containers (low pid limits); specifying an enormous --threads value; resource-exhausted hosts.","solutions":["Reduce the `--threads` value to something the environment supports (or omit it for default CPU count)","Check `ulimit -u` / container pids-limit and raise it if worker threads cannot be spawned","Free system resources or move to a less constrained host","Avoid catching this at the call site — it is fatal; if embedding Vector, build your own runtime and pass it in instead of `build_runtime`"],"exampleFix":"// before\nvector --threads 4096 --config config.yaml\n# panics: Unable to create async runtime\n// after\nvector --threads 4 --config config.yaml   # or omit --threads","handlingStrategy":"validation","validationCode":"let nproc = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1);\nassert!(threads <= nproc * 4, \"--threads {threads} likely exceeds environment thread limits\");","typeGuard":null,"tryCatchPattern":"// fatal at startup; no recovery — validate options before calling build_runtime\nmatch rt_builder.build() {\n    Ok(rt) => Ok(rt),\n    Err(e) => Err(format!(\"cannot start runtime ({e}); lower --threads or raise pid limits\")),\n}","preventionTips":["Cap --threads to available CPUs; omit the flag to use defaults","Raise container pids-limit / ulimit -u on constrained hosts","Smoke-test startup configs with low thread counts in CI containers mirroring production limits"],"tags":["rust","tokio","runtime","startup","threads"],"backgroundTag":"unsupported-platform","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}