{"record":{"id":"0305c36b9dfb67e4","repo":"oven-sh/bun","slug":"failed-to-initialize-client-transpiler","errorCode":null,"errorMessage":"Failed to initialize client transpiler: {}","messagePattern":"Failed to initialize client transpiler: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/bundler/bundle_v2.rs","lineNumber":255,"sourceCode":"\n    pub(crate) fn transpiler_for_target(&mut self, target: options::Target) -> &mut Transpiler<'a> {\n        // SAFETY: all three pointers are live for `'a` (set in `init`); the\n        // `client_transpiler` arm is only reached when bake populated it.\n        // Outside of server-components / dev-server,\n        // the only case that doesn't return the main transpiler is a\n        // browser-target request from a server-side build, which lazily\n        // spins up a client transpiler.\n        if !self.transpiler.options.server_components && self.linker.dev_server.is_none() {\n            if target == Target::Browser && self.transpiler.options.target.is_server_side() {\n                if let Some(p) = self.client_transpiler {\n                    // SAFETY: client_transpiler is live for `'a` (set in `init`);\n                    // pointer carries write provenance (constructed from `&mut`\n                    // / `NonNull::from(&mut _)`), and `&mut self` excludes any\n                    // overlapping `client_transpiler_ref()` borrow.\n                    return unsafe { p.assume_mut() };\n                }\n                return self.initialize_client_transpiler().unwrap_or_else(|e| {\n                    panic!(\"Failed to initialize client transpiler: {}\", e.name())\n                });\n            }\n            return &mut *self.transpiler;\n        }\n        // SAFETY: all three pointers are live for `'a` (set in `init`); the\n        // `client_transpiler` arm is only reached when bake populated it.\n        unsafe {\n            match target {\n                Target::Browser => self.client_transpiler.unwrap().assume_mut(),\n                Target::ServerComponentsSsr => &mut *self.ssr_transpiler,\n                _ => &mut *self.transpiler,\n            }\n        }\n    }\n\n    // draft `on_parse_task_complete` / `deinit_without_freeing_arena`\n    // removed — canonical bodies live in the later impl blocks below.\n}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/bundler/bundle_v2.rs#L237-L273","documentation":"Error \"Failed to initialize client transpiler: {}\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/bundler/bundle_v2.rs:255 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"}