{"record":{"id":"f0723d8e98759dbe","repo":"windmill-labs/windmill","slug":"bundle-not-found","errorCode":null,"errorMessage":"Bundle not found","messagePattern":"Bundle not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"cli/src/commands/app/dev.ts","lineNumber":923,"sourceCode":"      });\n      res.write(\"data: connected\\n\\n\");\n      clients.push(res);\n\n      req.on(\"close\", () => {\n        const index = clients.indexOf(res);\n        if (index !== -1) clients.splice(index, 1);\n      });\n      return;\n    }\n\n    // Serve the bundled JS\n    if (url === \"/dist/bundle.js\" || url === \"/bundle.js\") {\n      const jsPath = path.join(process.cwd(), \"dist/bundle.js\");\n      if (fs.existsSync(jsPath)) {\n        res.writeHead(200, { \"Content-Type\": \"application/javascript\" });\n        res.end(fs.readFileSync(jsPath));\n      } else {\n        res.writeHead(404);\n        res.end(\"Bundle not found\");\n      }\n      return;\n    }\n\n    // Serve the bundled CSS\n    if (url === \"/dist/bundle.css\" || url === \"/bundle.css\") {\n      const cssPath = path.join(process.cwd(), \"dist/bundle.css\");\n      if (fs.existsSync(cssPath)) {\n        res.writeHead(200, { \"Content-Type\": \"text/css\" });\n        res.end(fs.readFileSync(cssPath));\n      } else {\n        res.writeHead(404);\n        res.end(\"CSS not found\");\n      }\n      return;\n    }\n","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/app/dev.ts#L905-L941","documentation":"The local dev server started by `wmill app dev` (dev.ts) intercepts requests for `/dist/bundle.js` (or `/bundle.js`) and serves the file at `<cwd>/dist/bundle.js`. When that file does not exist on disk it responds with HTTP 404 and the body 'Bundle not found'. This is not a thrown exception but a 404 response the dev server generates, indicating the app bundle was never built or was built into a different directory.","triggerScenarios":"Browser (or the dev HTML shell) requests /dist/bundle.js while `wmill app dev` is running and `fs.existsSync(process.cwd() + '/dist/bundle.js')` is false — i.e. the JS bundle has not been produced by the bundler, or the CLI was launched from a directory whose dist/ folder lacks bundle.js.","commonSituations":"Starting `wmill app dev` before running the bundler/watcher that emits dist/bundle.js; bundler crashed or is still compiling on first load; running the CLI from the wrong working directory so it looks at a different dist/; cleaning dist/ while the dev server keeps serving; stale npm scripts that no longer emit to dist/.","solutions":["Build the app bundle first: from the app project root run the bundler (e.g. `wmill app bundle` or your npm build script) so `dist/bundle.js` exists.","Verify you launched `wmill app dev` from the app root — the server resolves `path.join(process.cwd(), 'dist/bundle.js')` relative to the current working directory.","Check the bundler terminal output for compile errors; a failed build leaves no bundle.js in dist/.","Keep the bundler in watch mode so the bundle is regenerated after edits, then hard-reload the browser (cache-bust with Ctrl+Shift+R).","If using a custom build script, confirm its outdir is `dist/` with entry `bundle.js` (or update the paths the dev server checks)."],"exampleFix":"// before: dev server started, bundle never built -> 404 'Bundle not found'\nwmill app dev\n\n// after: build (or watch) before/alongside dev\nwmill app bundle --watch &\nwmill app dev","handlingStrategy":"validation","validationCode":"const jsPath = require('path').join(process.cwd(), 'dist/bundle.js');\nif (!require('fs').existsSync(jsPath)) {\n  throw new Error(`Missing ${jsPath} - run the bundler before 'wmill app dev'`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const bundle = fs.readFileSync(path.join(process.cwd(), 'dist/bundle.js'));\n  res.writeHead(200, { 'Content-Type': 'application/javascript' });\n  res.end(bundle);\n} catch (err) {\n  if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n    res.writeHead(404);\n    res.end('Bundle not found - run the bundler first');\n  } else { throw err; }\n}","preventionTips":["Run the bundler in watch mode alongside `wmill app dev` so dist/bundle.js always exists.","Always launch the CLI from the app project root (the server resolves paths via process.cwd()).","Add a predev npm script that builds (or verifies) dist/bundle.js before starting the dev server.","Check bundler output for errors before reloading the browser."],"tags":["http-404","dev-server","typescript","build-artifacts"],"backgroundTag":"missing-build-artifact","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"}