{"record":{"id":"bf10796ac5823f2b","repo":"usebruno/bruno","slug":"port-port-is-already-in-use-on-this-system","errorCode":null,"errorMessage":"Port ${port} is already in use on this system.","messagePattern":"Port (.+?) is already in use on this system\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/app/mock-server/mock-server.js","lineNumber":145,"sourceCode":"\n  if (!(await isPortAvailable(normalizedPort))) {\n    return { available: false, reason: 'system' };\n  }\n\n  return { available: true, reason: null };\n};\n\nconst assertIsolatedPortAvailable = async (requestedPort, mockServerUid) => {\n  const port = Number(requestedPort) || DEFAULT_GATEWAY_PORT;\n  const result = await checkPortAvailable(port, { mockServerUid });\n\n  if (!result.available) {\n    if (result.reason === 'bruno' || result.reason === 'bruno-config') {\n      throw new Error(`Port ${port} is already used by another mock server in Bruno.`);\n    }\n\n    if (result.reason === 'system') {\n      throw new Error(`Port ${port} is already in use on this system.`);\n    }\n\n    throw new Error(`Port ${port} is not available.`);\n  }\n\n  return port;\n};\n\nconst resolveIsolatedPort = async (requestedPort, mockServerUid) => (\n  assertIsolatedPortAvailable(requestedPort, mockServerUid)\n);\n\nconst suggestPort = async (startPort = DEFAULT_GATEWAY_PORT, { additionalUsedPorts = [] } = {}) => {\n  const used = getUsedPorts();\n  for (const port of additionalUsedPorts) {\n    const normalizedPort = Number(port);\n    if (normalizedPort >= 1 && normalizedPort <= 65535) {\n      used.add(normalizedPort);","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/app/mock-server/mock-server.js#L127-L163","documentation":"Error \"Port ${port} is already in use on this system.\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/app/mock-server/mock-server.js:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different port for the mock server.","Find and stop the system process using the port (e.g. lsof -i :<port>)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}