{"record":{"id":"4117db53ea0d026f","repo":"denoland/deno","slug":"failed-to-locate-output-for-html-entry-js-e","errorCode":null,"errorMessage":"failed to locate output for HTML entry '{}'; {js_entry_name}","messagePattern":"failed to locate output for HTML entry '(.+?)'; (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/bundle/html.rs","lineNumber":509,"sourceCode":"    }\n\n    let entry_name = format!(\"{}{}\", self.entry_name, VIRTUAL_ENTRY_SUFFIX);\n    let js_entry_name = format!(\"{}.js\", entry_name);\n\n    let mut js_out_no_hash = None;\n    let js_out = html_output_files\n      .get_and_update_path(&js_entry_name, |p, f| {\n        let p = p.to_string_lossy();\n        js_out_no_hash = Some(\n          p.replace(entry_name.as_str(), &original_entry_name)\n            .replace(&format!(\"-{}\", f.hash), \"\")\n            .into(),\n        );\n\n        p.replace(entry_name.as_str(), &original_entry_name).into()\n      })\n      .ok_or_else(|| {\n        anyhow::anyhow!(\n          \"failed to locate output for HTML entry '{}'; {js_entry_name}\",\n          self.entry_name\n        )\n      })?;\n    let html_out_path = js_out_no_hash\n      .unwrap_or_else(|| js_out.clone())\n      .with_extension(\"html\");\n\n    // esbuild emits the external/linked sourcemap (`*.js.map`) for the entry\n    // under the internal virtual-entry name. Rename it to match the renamed JS\n    // bundle (e.g. `index-HASH.js.map`) and fix the JS `sourceMappingURL`\n    // reference so the emitted output doesn't leak the `deno-bundle-html.entry`\n    // implementation detail. See denoland/deno#30750.\n    let map_entry_name = format!(\"{}.js.map\", entry_name);\n    let mut old_map_name = None;\n    let new_map_out =\n      html_output_files.get_and_update_path(&map_entry_name, |p, _| {\n        old_map_name = p","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/bundle/html.rs#L491-L527","documentation":"HTML bundling builds each page through a virtual entry module (name + '-deno-bundle-html.entry') and afterwards renames esbuild's outputs by looking them up under that internal virtual name (cli/tools/bundle/html.rs:493-513). This error means the expected JS output file for the virtual entry was not among esbuild's output files - an invariant break in the HTML pipeline (esbuild output-naming change, an entry whose scripts produced no JS chunk, or an output-name collision), not a mistake in your flags.","triggerScenarios":"Bundling an .html entrypoint whose script graph yields no JS output file under the virtual entry name; esbuild version behavior change in entry-naming/hash placement; interaction of --minify/naming flags with the virtual-entry renaming; duplicate basenames colliding in HtmlOutputFiles' index.","commonSituations":"Early adopters of the HTML bundling feature after a Deno upgrade (esbuild pin moved); HTML pages referencing only CSS or empty scripts; pages whose script tags point at modules that esbuild tree-shakes to nothing.","solutions":["Update Deno - the HTML bundling pipeline and its output-renaming are actively fixed; skew between esbuild naming and this lookup is a known fragility","Bundle the script entry directly (deno bundle --outdir dist src/main.ts) to confirm the JS graph itself builds; if it does, the issue is HTML-specific - report it","Simplify the HTML (temporarily remove sourcemap/naming/minify flags) to see whether the JS output reappears under the virtual name","Report to denoland/deno with the HTML file and deno bundle invocation if it reproduces on the latest version"],"exampleFix":"# before: HTML entry fails to locate its JS output\ndeno bundle --outdir dist index.html\n# after: unblock by bundling the page's script entry directly\ndeno bundle --outdir dist index.html.src/main.ts  # path of the <script src=...> target\n# then file the HTML-path failure at github.com/denoland/deno/issues","handlingStrategy":"fallback","validationCode":"# Smoke-test the page's script graph separately before the HTML bundle\ndeno bundle --outdir /tmp/smoke \"$(grep -o 'src=\"[^\"]*\\.ts\"' index.html | head -1 | cut -d'\"' -f2)\" \\\n  && deno bundle --outdir dist index.html || echo 'HTML bundling invariant broken - bundle script entry directly and report'","typeGuard":null,"tryCatchPattern":"# Build script: fall back to bundling the script entry when HTML path fails\nif ! deno bundle --outdir dist index.html; then\n  echo 'falling back to script-entry bundle' >&2\n  deno bundle --outdir dist js/main.ts\nfi","preventionTips":["Pin your Deno version in CI so esbuild naming and the HTML pipeline stay in sync","Keep HTML pages simple (script tags pointing at local TS modules) while the feature matures","Report reproduction cases to denoland/deno to harden the virtual-entry lookup"],"tags":["bundle","html","esbuild","internal","naming"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}