{"record":{"id":"d750a7ee2a894939","repo":"elkowar/eww","slug":"failed-to-initialize-tokio-runtime","errorCode":null,"errorMessage":"Failed to initialize tokio runtime","messagePattern":"Failed to initialize tokio runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/main.rs","lineNumber":189,"sourceCode":"                    is_parent\n                }\n                Err(err) => Err(err)?,\n            }\n        }\n    };\n\n    if would_show_logs && opts.show_logs {\n        client::handle_client_only_action(&paths, opts::ActionClientOnly::Logs)?;\n    }\n    Ok(())\n}\n\nfn listen_for_daemon_response(mut recv: DaemonResponseReceiver) {\n    let rt = tokio::runtime::Builder::new_current_thread()\n        .thread_name(\"listen-for-daemon-response\")\n        .enable_all()\n        .build()\n        .expect(\"Failed to initialize tokio runtime\");\n    rt.block_on(async {\n        if let Ok(Some(response)) = tokio::time::timeout(Duration::from_millis(100), recv.recv()).await {\n            println!(\"{}\", response);\n        }\n    })\n}\n\n/// attempt to send a command to the daemon and send it the given action repeatedly.\nfn handle_server_command(paths: &EwwPaths, action: &ActionWithServer, connect_attempts: usize) -> Result<Option<DaemonResponse>> {\n    log::debug!(\"Trying to find server process at socket {}\", paths.get_ipc_socket_file().display());\n    let mut stream = attempt_connect(paths.get_ipc_socket_file(), connect_attempts).context(\"Failed to connect to daemon\")?;\n    log::debug!(\"Connected to Eww server ({}).\", &paths.get_ipc_socket_file().display());\n    client::do_server_call(&mut stream, action).context(\"Error while forwarding command to server\")\n}\n\nfn handle_daemon_response(res: DaemonResponse) {\n    match res {\n        DaemonResponse::Success(x) => println!(\"{}\", x),","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/main.rs#L171-L207","documentation":"`listen_for_daemon_response` builds a dedicated single-thread tokio runtime to await a short-timeout daemon response. `Runtime::build()` returned an Err and `expect` panicked with this message. Runtime construction fails under unsupported or restricted runtime configurations (e.g. io/time drivers unavailable in this build/thread context).","triggerScenarios":"Calling `listen_for_daemon_response` (from `run`) when `tokio::runtime::Builder::new_current_thread().enable_all().build()` fails.","commonSituations":"Building against a tokio feature set lacking required drivers (missing `rt`, `time`, or `net` features); exotic embedded environments; extremely constrained systems.","solutions":["Ensure Cargo.toml enables full tokio features: `tokio = { version = \"1\", features = [\"full\"] }`.","Rebuild/upgrade tokio and eww to resolve build-feature mismatches.","If embedding, avoid constructing runtimes inside another runtime thread; run this path on a plain thread."],"exampleFix":"// Cargo.toml before\ntokio = \"1\"\n// after\ntokio = { version = \"1\", features = [\"full\"] }","handlingStrategy":"try-catch","validationCode":"// build-time check: ensure tokio features\n// tokio = { version = \"1\", features = [\"full\"] }","typeGuard":null,"tryCatchPattern":"let rt = tokio::runtime::Builder::new_current_thread().enable_all().build()\n    .map_err(|e| anyhow::anyhow!(\"failed to init runtime: {e}\"))?;","preventionTips":["Enable `full` (or rt/time/net) tokio features in Cargo.toml.","Never construct tokio runtimes inside another runtime's thread.","Keep tokio versions consistent across the dependency tree."],"tags":[],"backgroundTag":null,"analyzedSha":"48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa","analyzedAt":"2026-09-08T03:13:26.897Z","contentChangedAt":"2026-09-08T03:13:26.897Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}