{"record":{"id":"e85d72f05f604d85","repo":"denoland/deno","slug":"expected-a-metafile-to-be-present","errorCode":null,"errorMessage":"expected a metafile to be present","messagePattern":"expected a metafile to be present","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/bundle/mod.rs","lineNumber":946,"sourceCode":"    if !processed.is_js {\n      continue;\n    }\n    return Ok(\n      processed\n        .into_contents()\n        .unwrap_or_else(|| file.contents.to_vec()),\n    );\n  }\n\n  deno_core::anyhow::bail!(\"esbuild produced no JavaScript output\")\n}\n\nfn metafile_from_response(\n  response: &BuildResponse,\n) -> Result<esbuild_client::Metafile, AnyError> {\n  Ok(serde_json::from_str::<esbuild_client::Metafile>(\n    response.metafile.as_deref().ok_or_else(|| {\n      deno_core::anyhow::anyhow!(\"expected a metafile to be present\")\n    })?,\n  )?)\n}\n\nasync fn bundle_watch(\n  flags: Arc<Flags>,\n  bundler: EsbuildBundler,\n  minified: bool,\n  platform: BundlePlatform,\n  output_dir: Option<&Path>,\n) -> Result<(), AnyError> {\n  let (initial_roots, always_watch) = match &bundler.input {\n    BundlerInput::Entrypoints(entries) => (\n      entries\n        .iter()\n        .filter_map(|(_, root)| {\n          let url = Url::parse(root).ok()?;\n          deno_path_util::url_to_file_path(&url).ok()","sourceCodeStart":928,"sourceCodeEnd":964,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/bundle/mod.rs#L928-L964","documentation":"The Deno bundling pipeline always requests a metafile (esbuild's JSON manifest of inputs and outputs) alongside the build. When the build response comes back without one, this internal invariant fails — Deno cannot map outputs back to entrypoints or rewrite HTML/asset references without it.","triggerScenarios":"An esbuild build response missing the metafile field: a version/protocol mismatch with the esbuild service deno drives, or an internal bug where the build request lost its `metafile: true` setting.","commonSituations":"Almost always an internal deno/esbuild integration issue rather than user config — e.g. after upgrading deno mid-pipeline, or unusual modes (watch, HTML) exercising a less-tested path.","solutions":["Re-run the bundle once to rule out a transient IPC hiccup with the esbuild service","Update deno to the latest version — the bundled esbuild protocol changes in lockstep with the CLI","If reproducible, minimize the entry and file a deno issue with the command and `deno --version` output"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Wrap `deno bundle` in scripts with a retry-once wrapper: catch this internal error, re-run once, and fail loudly with the command + `deno --version` if it repeats — it is not fixable from user code.","preventionTips":["Keep deno updated so the bundled esbuild protocol stays in sync","Pin a known-good deno version in CI","Report reproducible occurrences with a minimal entry"],"tags":["bundle","esbuild","internal"],"backgroundTag":"bundler-metadata-missing","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}