{"record":{"id":"a64a553930023605","repo":"windmill-labs/windmill","slug":"failed-to-open-browser-e-message","errorCode":null,"errorMessage":"Failed to open browser: ${e.message}","messagePattern":"Failed to open browser: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/pipeline/dev.ts","lineNumber":263,"sourceCode":"  });\n\n  // The `/pipeline_dev` page is served by the frontend, not the backend. By\n  // default we open it on the workspace remote, but that 404s on a remote whose\n  // deployed frontend predates this route — `--frontend` points the page at a\n  // locally-run frontend (`REMOTE=<remote> npm run dev`) while the API/token\n  // still target the remote. Normalize to a single trailing slash either way.\n  const pageBase = (opts.frontend ?? workspace.remote).replace(/\\/?$/, \"/\");\n  const url =\n    `${pageBase}pipeline_dev?workspace=${workspace.workspaceId}` +\n    `&wm_token=${workspace.token}&folder=${encodeURIComponent(folder)}&port=${port}` +\n    `&ws_token=${encodeURIComponent(wsToken)}`;\n\n  server.listen(port, LISTEN_HOST, () => {\n    log.info(colors.green.bold(`🚀 Pipeline dev server on ws://localhost:${port}/ws`));\n    log.info(colors.gray(`Open: ${url}`));\n    if (opts.open !== false) {\n      open.default(url).catch((e: any) =>\n        log.warn(colors.yellow(`Failed to open browser: ${e.message}`)),\n      );\n    }\n  });\n\n  process.on(\"SIGINT\", () => {\n    log.info(colors.yellow(\"\\n🛑 Shutting down…\"));\n    watcher.close();\n    for (const ws of clients) ws.close();\n    server.close();\n    process.exit(0);\n  });\n}\n\nconst command = new Command()\n  .description(\n    \"Live-preview a data pipeline from local files: watch an `f/<folder>` of `// pipeline` scripts, push the working-tree graph to the dev page, and run the cascade via preview (no deploy).\",\n  )\n  .arguments(\"[folder:string]\")","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/pipeline/dev.ts#L245-L281","documentation":"`wmill pipeline dev` tries to open the pipeline dev URL in your default browser via the `open` package when --open is not false. If launching the browser fails, it logs this warning and continues — the server keeps running and the URL is printed, so you can open it manually.","triggerScenarios":"server.listen succeeded and opts.open !== false, but the `open` promise rejects: no browser/xdg-open available, headless CI/SSH/container environment, DISPLAY/WAYLAND not set, or a malformed default-browser handler.","commonSituations":"Running in WSL without a Windows browser configured; SSH into a server with no GUI; Docker container; CI runner; Linux box without xdg-open; macOS default browser handler broken.","solutions":["Copy the `Open: <url>` line printed by the command into a browser manually — nothing else is broken.","Pass --open=false (or --no-open) to suppress the attempt and the warning in headless environments.","Install/configure a browser opener on the host (xdg-open, or set $BROWSER on Linux).","Set DISPLAY/Wayland session variables if running from a non-GUI shell on a desktop machine."],"exampleFix":"// before (headless box, warning every run)\nwmill pipeline dev\n// after\nwmill pipeline dev --open=false","handlingStrategy":"fallback","validationCode":"// detect headless environment before relying on browser opening\nconst headless = !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY && process.platform === 'linux';\nconst args = headless ? ['--open=false'] : [];","typeGuard":null,"tryCatchPattern":"// the CLI already catches internally; when scripting, tolerate it\nopen.default(url).catch(e => {\n  console.warn(`browser failed (${e.message}); open ${url} manually`);\n});","preventionTips":["Pass --open=false on servers, containers, SSH and CI.","Set $BROWSER or install xdg-open on minimal Linux images.","Always print/copy the URL instead of relying on auto-open.","In WSL, configure a Windows browser bridge."],"tags":["browser","cli","dev-server","headless"],"backgroundTag":"browser-open-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"}