{"record":{"id":"293472c391cbe859","repo":"zed-industries/zed","slug":"failed-to-spawn-dedicated-thread","errorCode":null,"errorMessage":"failed to spawn dedicated thread","messagePattern":"failed to spawn dedicated thread","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/scheduler/src/scheduler.rs","lineNumber":212,"sourceCode":"        // lives inside a spawned task or a user-held executor clone. The\n        // recv loop exits once all of those are gone.\n        drop(executor);\n\n        while let Ok(runnable) = runnable_receiver.recv() {\n            runnable.run();\n        }\n    };\n    spawn_dedicated_os_thread(session_id, thread_body);\n    task\n}\n\nfn spawn_dedicated_os_thread(session_id: SessionId, thread_body: impl FnOnce() + Send + 'static) {\n    let thread_name = format!(\"spawn_dedicated session {:?}\", session_id);\n    #[cfg(not(target_family = \"wasm\"))]\n    std::thread::Builder::new()\n        .name(thread_name)\n        .spawn(thread_body)\n        .expect(\"failed to spawn dedicated thread\");\n    #[cfg(all(target_family = \"wasm\", feature = \"wasm-threads\"))]\n    wasm_thread::Builder::new()\n        .name(thread_name)\n        .spawn(thread_body)\n        .expect(\"failed to spawn dedicated thread\");\n    #[cfg(all(target_family = \"wasm\", not(feature = \"wasm-threads\")))]\n    {\n        let _ = (thread_name, thread_body);\n        panic!(\"spawn_dedicated on wasm requires the scheduler crate's `wasm-threads` feature\");\n    }\n}\n\n#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]\npub struct SessionId(u16);\n\nimpl SessionId {\n    pub fn new(id: u16) -> Self {\n        SessionId(id)","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/scheduler/src/scheduler.rs#L194-L230","documentation":"Raised in spawn_dedicated_os_thread(): std::thread::Builder::spawn for the dedicated scheduler thread failed (thread creation error, e.g. resource limits), so the dedicated executor session cannot start.","triggerScenarios":"Thrown at crates/scheduler/src/scheduler.rs:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce concurrent thread usage in the process","Check ulimit -u / pthread limits on the host","Retry after load subsides or fall back to a shared thread pool"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}