{"record":{"id":"b251ba942f526068","repo":"windmill-labs/windmill","slug":"failed-to-download-esbuild-wasm-version-res","errorCode":null,"errorMessage":"Failed to download esbuild-wasm@${version} (${res.status} ${res.statusText}). Set WINDMILL_ESBUILD_WASM_PATH to an extracted esbuild-wasm package dir, point WINDMILL_ESBUILD_WASM_URL at a reachable tarball, or repair the native esbuild install.","messagePattern":"Failed to download esbuild-wasm@(.+?) \\((.+?) (.+?)\\)\\. Set WINDMILL_ESBUILD_WASM_PATH to an extracted esbuild-wasm package dir, point WINDMILL_ESBUILD_WASM_URL at a reachable tarball, or repair the native esbuild install\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/utils/esbuild_loader.ts","lineNumber":128,"sourceCode":" * and extracts the npm tarball.\n */\nasync function ensureWasmPackage(version: string): Promise<string> {\n  // Explicit local override wins (air-gapped / self-hosted workers): a path to\n  // an already-extracted esbuild-wasm package directory.\n  const override = process.env.WINDMILL_ESBUILD_WASM_PATH;\n  if (override) return override;\n\n  const destDir = path.join(cacheDir(), `esbuild-wasm-${version}`);\n  if (fs.existsSync(path.join(destDir, \"lib\", \"main.js\"))) {\n    return destDir;\n  }\n\n  const url = process.env.WINDMILL_ESBUILD_WASM_URL ??\n    `https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-${version}.tgz`;\n  log.info(`Downloading esbuild-wasm@${version} from ${url} ...`);\n  const res = await fetch(url);\n  if (!res.ok || !res.body) {\n    throw new Error(\n      `Failed to download esbuild-wasm@${version} (${res.status} ${res.statusText}). ` +\n        `Set WINDMILL_ESBUILD_WASM_PATH to an extracted esbuild-wasm package dir, ` +\n        `point WINDMILL_ESBUILD_WASM_URL at a reachable tarball, or repair the native esbuild install.`\n    );\n  }\n\n  // Extract to a unique temp dir and rename into place so a crash or a\n  // concurrent writer can't leave a half-extracted package behind, and so two\n  // extractions never share an in-progress directory.\n  const tmpDir = `${destDir}.${process.pid}.${extractCounter++}.tmp`;\n  fs.rmSync(tmpDir, { recursive: true, force: true });\n  await extractTarball(res.body, tmpDir);\n  if (!fs.existsSync(path.join(tmpDir, \"lib\", \"main.js\"))) {\n    fs.rmSync(tmpDir, { recursive: true, force: true });\n    throw new Error(`esbuild-wasm@${version} tarball did not contain lib/main.js`);\n  }\n  try {\n    fs.renameSync(tmpDir, destDir);","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/esbuild_loader.ts#L110-L146","documentation":"This error is thrown by ensureWasmPackage in cli/src/utils/esbuild_loader.ts when the CLI's esbuild-wasm fallback cannot download the esbuild-wasm npm tarball. The fallback activates only after native esbuild fails its smoke test (e.g. host/binary version mismatch), so this error means the native esbuild is broken AND the wasm rescue download failed. The thrown message carries the HTTP status/statusText and the three configured escape hatches (WINDMILL_ESBUILD_WASM_PATH, WINDMILL_ESBUILD_WASM_URL, or repairing native esbuild).","triggerScenarios":"Native esbuild fails its transform() smoke test, so the code fetches the tarball from WINDMILL_ESBUILD_WASM_URL or https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-<version>.tgz, and fetch returns res.ok === false or an empty body (HTTP 404, 403, 5xx, or a network error page).","commonSituations":"Air-gapped or firewalled machines/CI where registry.npmjs.org is unreachable; a corporate proxy blocking the fetch; a custom WINDMILL_ESBUILD_WASM_URL pointing at a missing or wrong-version tarball; a broken npm install (version-mismatched @esbuild/<platform> binary) that triggered the fallback in the first place; npm registry outages or rate limiting.","solutions":["Fix network access to the registry (check proxy/firewall/DNS; verify with `curl -I https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.28.0.tgz`).","Set WINDMILL_ESBUILD_WASM_PATH to an already-extracted esbuild-wasm package directory containing lib/main.js (works fully offline).","Set WINDMILL_ESBUILD_WASM_URL to a reachable tarball (internal mirror or a manually downloaded .tgz).","Repair the native esbuild install (`npm rebuild esbuild` or reinstall the CLI) so the wasm fallback is never needed."],"exampleFix":"// before: broken native install + no network path\n// CLI falls back to wasm download and fails\n// after: provide an offline override\nexport WINDMILL_ESBUILD_WASM_PATH=/opt/vendor/esbuild-wasm-0.28.0\n# dir must contain lib/main.js, bin/esbuild, esbuild.wasm","handlingStrategy":"fallback","validationCode":"// Check the fallback source is reachable before running wmill\nconst url = process.env.WINDMILL_ESBUILD_WASM_URL ??\n  `https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.28.0.tgz`;\nconst res = await fetch(url, { method: \"HEAD\" });\nif (!res.ok) throw new Error(`esbuild-wasm source unreachable: ${res.status} — set WINDMILL_ESBUILD_WASM_PATH or fix network`);\n// or, for offline environments, verify the override:\n// fs.existsSync(path.join(process.env.WINDMILL_ESBUILD_WASM_PATH, \"lib\", \"main.js\"))","typeGuard":"function isOkResponse(res: Response): boolean {\n  return res.ok && res.body !== null;\n}","tryCatchPattern":"try {\n  await getEsbuild();\n} catch (e) {\n  if (String(e).includes(\"Failed to download esbuild-wasm\")) {\n    // repair native esbuild so the wasm fallback is not needed\n    console.error(\"Fix network or set WINDMILL_ESBUILD_WASM_PATH to an extracted esbuild-wasm dir\");\n  }\n  throw e;\n}","preventionTips":["Keep the native esbuild install healthy (rebuild after node/npm upgrades) so the wasm download path never triggers.","Set WINDMILL_ESBUILD_WASM_PATH to a vendored esbuild-wasm dir in air-gapped/CI environments.","Verify WINDMILL_ESBUILD_WASM_URL with a HEAD request before relying on a custom mirror.","Pre-download and cache the package once on machines with restricted network access."],"tags":["network","download","esbuild","fallback","npm-registry"],"backgroundTag":"npm-tarball-download-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}