{"record":{"id":"6f4f7ac5c06dac54","repo":"zellij-org/zellij","slug":"failed-to-build-forward-timeout-runtime","errorCode":null,"errorMessage":"failed to build forward-timeout runtime","messagePattern":"failed to build forward-timeout runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"zellij-client/src/stdin_ansi_parser.rs","lineNumber":912,"sourceCode":"// Forward-slot timeout infrastructure\n// =====================================================================\n\nuse std::sync::{Arc, Mutex, OnceLock};\n\n/// Dedicated, lazily-initialised runtime for driving forward-slot\n/// timeouts. A single current-thread executor runs on its own OS\n/// thread; timer tasks are `spawn`-ed onto it from the synchronous\n/// `ClientInstruction::ForwardQueryToHost` handler. One-thread model\n/// because timer tasks do no CPU work — they just sleep and perform a\n/// millisecond-scale mutex check on wake-up.\nstatic FORWARD_TIMEOUT_RUNTIME: OnceLock<Arc<tokio::runtime::Runtime>> = OnceLock::new();\n\npub fn forward_timeout_runtime() -> &'static Arc<tokio::runtime::Runtime> {\n    FORWARD_TIMEOUT_RUNTIME.get_or_init(|| {\n        let rt = tokio::runtime::Builder::new_current_thread()\n            .enable_time()\n            .build()\n            .expect(\"failed to build forward-timeout runtime\");\n        let rt = Arc::new(rt);\n        let rt_for_driver = rt.clone();\n        // `block_on(pending())` keeps the executor loop alive forever\n        // on this thread; spawned timer tasks are polled as they\n        // become ready (on spawn, on wake from the time driver).\n        std::thread::Builder::new()\n            .name(\"zellij-client-forward-timeout\".into())\n            .spawn(move || {\n                rt_for_driver.block_on(std::future::pending::<()>());\n            })\n            .expect(\"failed to spawn forward-timeout driver thread\");\n        rt\n    })\n}\n\n/// Spawn a timer task that closes a forward slot after `deadline` and\n/// invokes `on_timeout(token, reply_bytes)` with whatever the slot\n/// accumulated. Token-guard idempotent: if the barrier (or a","sourceCodeStart":894,"sourceCodeEnd":930,"githubUrl":"https://github.com/zellij-org/zellij/blob/e839bfffa586992364309a685b2c71f3b23c247e/zellij-client/src/stdin_ansi_parser.rs#L894-L930","documentation":"Error \"failed to build forward-timeout runtime\" thrown in zellij-org/zellij.","triggerScenarios":"Occurs at zellij-client/src/stdin_ansi_parser.rs:903 when the operation fails: \"failed to build forward-timeout runtime\". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.","commonSituations":"Resource exhaustion or restrictive ulimits/namespace settings.","solutions":["Check system resources (threads, memory); tokio runtime creation failed at the OS level.","Retry; if persistent, report with OS and resource limit details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e839bfffa586992364309a685b2c71f3b23c247e","analyzedAt":"2026-08-19T07:42:58.758Z","contentChangedAt":"2026-08-19T07:42:58.758Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}