oven-sh/bun · error

Failed to initialize client transpiler: {}

Error message

Failed to initialize client transpiler: {}

What it means

Error "Failed to initialize client transpiler: {}" thrown in oven-sh/bun.

Source

Thrown at src/bundler/bundle_v2.rs:255

    pub(crate) fn transpiler_for_target(&mut self, target: options::Target) -> &mut Transpiler<'a> {
        // SAFETY: all three pointers are live for `'a` (set in `init`); the
        // `client_transpiler` arm is only reached when bake populated it.
        // Outside of server-components / dev-server,
        // the only case that doesn't return the main transpiler is a
        // browser-target request from a server-side build, which lazily
        // spins up a client transpiler.
        if !self.transpiler.options.server_components && self.linker.dev_server.is_none() {
            if target == Target::Browser && self.transpiler.options.target.is_server_side() {
                if let Some(p) = self.client_transpiler {
                    // SAFETY: client_transpiler is live for `'a` (set in `init`);
                    // pointer carries write provenance (constructed from `&mut`
                    // / `NonNull::from(&mut _)`), and `&mut self` excludes any
                    // overlapping `client_transpiler_ref()` borrow.
                    return unsafe { p.assume_mut() };
                }
                return self.initialize_client_transpiler().unwrap_or_else(|e| {
                    panic!("Failed to initialize client transpiler: {}", e.name())
                });
            }
            return &mut *self.transpiler;
        }
        // SAFETY: all three pointers are live for `'a` (set in `init`); the
        // `client_transpiler` arm is only reached when bake populated it.
        unsafe {
            match target {
                Target::Browser => self.client_transpiler.unwrap().assume_mut(),
                Target::ServerComponentsSsr => &mut *self.ssr_transpiler,
                _ => &mut *self.transpiler,
            }
        }
    }

    // draft `on_parse_task_complete` / `deinit_without_freeing_arena`
    // removed — canonical bodies live in the later impl blocks below.
}

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/bundler/bundle_v2.rs:255 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/0305c36b9dfb67e4. Report an issue: GitHub.