denoland/deno · error
Deno.bundle() is not available in compiled binaries (`deno c
Error message
Deno.bundle() is not available in compiled binaries (`deno compile`). Run with `deno run` instead, or pre-bundle the entrypoints at build time.
What it means
`Deno.bundle()` requires a real BundleProvider wired into the runtime. Standalone binaries produced by `deno compile` embed `denort`, which registers the no-op `()` provider, and calling bundle() on it returns this error instead of the old 'default BundleProvider does not do anything' string (denoland/deno#31597).
Source
Thrown at ext/bundle/src/lib.rs:52
} else {
state.put::<Arc<dyn BundleProvider>>(Arc::new(()));
}
},
);
#[async_trait]
impl BundleProvider for () {
async fn bundle(
&self,
_options: BundleOptions,
_permissions: PermissionsContainer,
) -> Result<BuildResponse, AnyError> {
// Embedders that don't wire up a real provider (notably `denort`, used
// by `deno compile` outputs) fall through to this no-op implementation.
// Surface that limitation directly to the user instead of leaking the
// historical "default BundleProvider does not do anything" string.
// See denoland/deno#31597.
Err(deno_core::anyhow::anyhow!(
"Deno.bundle() is not available in compiled binaries (`deno compile`). \
Run with `deno run` instead, or pre-bundle the entrypoints at build time."
))
}
}
#[async_trait]
pub trait BundleProvider: Send + Sync {
async fn bundle(
&self,
options: BundleOptions,
permissions: PermissionsContainer,
) -> Result<BuildResponse, AnyError>;
}
#[derive(Clone, Debug, Eq, PartialEq, Default, FromV8)]
pub struct BundleOptions {
pub entrypoints: Vec<String>,View on GitHub (pinned to 89f33cbef2)
Solutions
- Run the code with `deno run` instead of the compiled binary
- Pre-bundle the entrypoints at build time (invoke bundling in the build pipeline) and compile the already-bundled output
- Catch the error at runtime and fall back to a pre-generated bundle shipped alongside the binary
Example fix
// before
const result = await Deno.bundle(entry);
// after
let result;
try {
result = await Deno.bundle(entry);
} catch (err) {
if (/not available in compiled binaries/.test(String(err?.message ?? err))) {
result = prebuiltBundle; // generated during `deno compile` build step
} else {
throw err;
}
} Defensive patterns
Strategy: try-catch
Try / catch
try {
const result = await Deno.bundle(entry);
} catch (err) {
if (/not available in compiled binaries/.test(String(err?.message ?? err))) {
return prebuiltBundle; // produced during the `deno compile` build step
}
throw err;
} Prevention
- Pre-bundle at build time instead of bundling at runtime in compiled binaries
- Keep bundling logic in scripts run with `deno run`, not inside `deno compile` outputs
- Feature-test Deno.bundle once at startup and cache the capability flag
When it happens
Trigger: Executing code that calls `Deno.bundle(options)` inside a binary created with `deno compile`, or under any embedder that did not install a BundleProvider.
Common situations: A bundler/build tool that works under `deno run` is shipped as a compiled binary and still tries to bundle on demand; CI compiles the tool; embedders forget to wire the provider.
Related errors
- The bench function must have a name
- ${prefix}Linter plugin name must be a string
- web workers are not supported
- could not get fetch esbuild binary; download it manually and
- failed to locate output for HTML entry '{}'; {js_entry_name}
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/06c0b3fe57e86478.
Report an issue: GitHub.