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

  1. Run the code with `deno run` instead of the compiled binary
  2. Pre-bundle the entrypoints at build time (invoke bundling in the build pipeline) and compile the already-bundled output
  3. 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

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


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/06c0b3fe57e86478. Report an issue: GitHub.