{"record":{"id":"9d1f4a800b60ba7e","repo":"windmill-labs/windmill","slug":"port-requested-is-already-in-use-holderhint","errorCode":null,"errorMessage":"Port ${requested} is already in use${holderHint}. Using port ${port} instead.","messagePattern":"Port (.+?) is already in use(.+?)\\. Using port (.+?) instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/dev/dev.ts","lineNumber":817,"sourceCode":"  //\n  // Runs a localhost HTTP server that:\n  //   - serves the dev page from `http://localhost:<proxyPort>/` (forwarded\n  //     to the remote workspace), so embedders that need a localhost origin\n  //     can render it (e.g. Claude Code's port-detection preview), and\n  //   - upgrades local /ws connections back to this same process for the\n  //     live-reload channel.\n  //\n  // The simpler \"direct\" mode below works for standalone browser tabs and the\n  // VS Code extension's iframe — only embedders that demand a localhost origin\n  // need this proxy.\n\n  async function startProxyServer(requestedPort: number) {\n    // Probe both IPv4 and IPv6 stacks before binding. If the requested port is\n    // taken on either, walk upward to the next free one so we don't silently\n    // collide with a leftover dev server (see cli/src/utils/port-probe.ts).\n    const proxyPort = await resolveBindPort(requestedPort, \"--proxy-port\", {\n      info: (m) => console.log(m),\n      warn: (m) => console.warn(m),\n    });\n\n    const remote = new URL(workspace.remote);\n    const isHttps = remote.protocol === \"https:\";\n    const remoteHost = remote.hostname;\n    const remotePort = remote.port ? parseInt(remote.port) : (isHttps ? 443 : 80);\n    const httpModule = isHttps ? https : http;\n\n    const devWss = new WebSocketServer({ noServer: true });\n    setupDevWs(devWss);\n\n    const proxyWss = new WebSocketServer({ noServer: true });\n\n    const proxyServer = http.createServer((clientReq, clientRes) => {\n      const parsedUrl = new URL(clientReq.url ?? \"/\", `http://localhost`);\n      if (parsedUrl.pathname === \"/\" || parsedUrl.pathname === \"\") {\n        let devUrl = `/dev?workspace=${workspace.workspaceId}&local=true&wm_token=${workspace.token}&port=${proxyPort}`;\n        if (opts.path) {","sourceCodeStart":799,"sourceCodeEnd":835,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/dev/dev.ts#L799-L835","documentation":"Emitted by the proxy/dev server startup in `wmill dev`: the requested localhost port is occupied (holderHint names the process when found), so bind probing shifted up to the next free port and that substitute port is used. Dev functionality is unaffected; only embedders that hardcode the original port notice.","triggerScenarios":"Thrown at cli/src/commands/dev/dev.ts:817 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Free the requested port (stop the holder named in the hint)","Pass a different explicit port flag","Read the chosen port from the command output instead of assuming the default"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}