{"record":{"id":"f7ecb71d2cea1e44","repo":"oven-sh/bun","slug":"failed-to-create-waker","errorCode":null,"errorMessage":"Failed to create waker","messagePattern":"Failed to create waker","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/bundler/BundleThread.rs","lineNumber":194,"sourceCode":"        // `UnboundedQueue::push` takes `&self` (lock-free MPSC). `Waker::wake` takes\n        // `&self` on all platforms and only reads a Copy field (eventfd, mach port,\n        // `WindowsLoop` pointer) to pass to a wake call that is safe from any thread\n        // (eventfd write, mach_msg send, uv_async_send), so the `&Waker` autoref is\n        // sound alongside `wait(&self)` in `thread_main` and other `enqueue` callers.\n        unsafe {\n            (*instance).queue.push(completion);\n            (*instance).waker.wake();\n        }\n    }\n\n    unsafe fn thread_main(instance: *mut Self) {\n        Output::Source::configure_named_thread(zstr!(\"Bundler\"));\n\n        // SAFETY: `waker` is written exactly once here, before `ready_event.set()`\n        // releases any thread that could call `enqueue` (which reads `waker`).\n        unsafe {\n            core::ptr::addr_of_mut!((*instance).waker)\n                .write(Async::Waker::init().unwrap_or_else(|_| panic!(\"Failed to create waker\")));\n        }\n\n        // Unblock the calling thread so it can continue.\n        // SAFETY: raw-ptr field projection; spawning thread is blocked in `ready_event.wait()`.\n        unsafe { (*instance).ready_event.set() };\n\n        // The libuv Timer lives on stack for the lifetime of this never-returning fn.\n        // It MUST be declared at function scope (not inside the `#[cfg(windows)] { ... }`\n        // block below) because `timer.init()`/`timer.start()` register `&timer`'s address\n        // into the uv loop's intrusive handle queue / timer min-heap, and `waker.wait()`\n        // (→ `uv_run`) in the `loop {}` below dereferences that address.\n        #[cfg(windows)]\n        let mut timer: bun_sys::windows::libuv::Timer = bun_core::ffi::zeroed();\n        #[cfg(windows)]\n        {\n            // SAFETY: raw place read of `waker.loop_.uv_loop` (Copy ptr); field is\n            // write-once in `Waker::init()` above and never mutated by `wake()`, so a\n            // concurrent `enqueue()` (possible now that `ready_event.set()` has fired)","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/bundler/BundleThread.rs#L176-L212","documentation":"Error \"Failed to create waker\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/bundler/BundleThread.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}