{"record":{"id":"06c0b3fe57e86478","repo":"denoland/deno","slug":"deno-bundle-is-not-available-in-compiled-binarie","errorCode":null,"errorMessage":"Deno.bundle() is not available in compiled binaries (`deno compile`). Run with `deno run` instead, or pre-bundle the entrypoints at build time.","messagePattern":"Deno\\.bundle\\(\\) is not available in compiled binaries \\(`deno compile`\\)\\. Run with `deno run` instead, or pre-bundle the entrypoints at build time\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/bundle/src/lib.rs","lineNumber":52,"sourceCode":"    } else {\n      state.put::<Arc<dyn BundleProvider>>(Arc::new(()));\n    }\n  },\n);\n\n#[async_trait]\nimpl BundleProvider for () {\n  async fn bundle(\n    &self,\n    _options: BundleOptions,\n    _permissions: PermissionsContainer,\n  ) -> Result<BuildResponse, AnyError> {\n    // Embedders that don't wire up a real provider (notably `denort`, used\n    // by `deno compile` outputs) fall through to this no-op implementation.\n    // Surface that limitation directly to the user instead of leaking the\n    // historical \"default BundleProvider does not do anything\" string.\n    // See denoland/deno#31597.\n    Err(deno_core::anyhow::anyhow!(\n      \"Deno.bundle() is not available in compiled binaries (`deno compile`). \\\n       Run with `deno run` instead, or pre-bundle the entrypoints at build time.\"\n    ))\n  }\n}\n\n#[async_trait]\npub trait BundleProvider: Send + Sync {\n  async fn bundle(\n    &self,\n    options: BundleOptions,\n    permissions: PermissionsContainer,\n  ) -> Result<BuildResponse, AnyError>;\n}\n\n#[derive(Clone, Debug, Eq, PartialEq, Default, FromV8)]\npub struct BundleOptions {\n  pub entrypoints: Vec<String>,","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/ext/bundle/src/lib.rs#L34-L70","documentation":"`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).","triggerScenarios":"Executing code that calls `Deno.bundle(options)` inside a binary created with `deno compile`, or under any embedder that did not install a BundleProvider.","commonSituations":"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.","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"],"exampleFix":"// before\nconst result = await Deno.bundle(entry);\n\n// after\nlet result;\ntry {\n  result = await Deno.bundle(entry);\n} catch (err) {\n  if (/not available in compiled binaries/.test(String(err?.message ?? err))) {\n    result = prebuiltBundle; // generated during `deno compile` build step\n  } else {\n    throw err;\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const result = await Deno.bundle(entry);\n} catch (err) {\n  if (/not available in compiled binaries/.test(String(err?.message ?? err))) {\n    return prebuiltBundle; // produced during the `deno compile` build step\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["bundle","deno-compile","runtime","api-availability"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}