quasarframework/quasar · error · Error
ERROR_NETWORK_PORT_NOT_AVAIL
ERROR_NETWORK_PORT_NOT_AVAIL
Error message
ERROR_NETWORK_PORT_NOT_AVAIL
What it means
findClosestOpenPort scans upward from the requested port to 65535 looking for a free port on the given host and throws ERROR_NETWORK_PORT_NOT_AVAIL when the entire remaining port range is exhausted. The dev server infrastructure calls it via openPort/#computeConfig to pick a port for the dev server, so this failure means no usable TCP port could be bound.
Source
Thrown at app-vite/lib/utils/net.js:50
list.push(networkAddress.address)
}
}
}
return list
}
export async function findClosestOpenPort(port, host) {
let portProposal = port
do {
if (await isPortAvailable(portProposal, host)) {
return portProposal
}
portProposal++
} while (portProposal < 65_535)
throw new Error('ERROR_NETWORK_PORT_NOT_AVAIL')
}
export function isPortAvailable(port, host) {
const { promise, resolve, reject } = Promise.withResolvers()
const tester = net
.createServer()
.once('error', err => {
if (err.code === 'EADDRNOTAVAIL') {
reject(new Error('ERROR_NETWORK_ADDRESS_NOT_AVAIL'))
} else if (err.code === 'EADDRINUSE') {
resolve(false) // host/port in use
} else {
reject(err)
}
})
.once('listening', () => {
testerView on GitHub (pinned to 4841521b5f)
Solutions
- Check what is consuming ports with 'ss -ltn' or 'lsof -i -P -n | grep LISTEN' and kill leaked/stale processes
- Retry on a fresh machine/container restart to release ephemeral sockets
- Verify the host argument matches a real local interface (localhost/127.0.0.1 or the intended IP)
- Lower the starting port (e.g. 9000 instead of 64000) so the scan has more room before 65535
- Inspect container/CI network limits (ulimit, sysctl net.ipv4.ip_local_port_range)
Example fix
// before
const port = await openPort({ port: 65000, host: '0.0.0.0' }) // scans to 65535 quickly
// after
const port = await openPort({ port: 9000, host: 'localhost' }) Defensive patterns
Strategy: retry
Validate before calling
const net = require('node:net')
async function portFree(port, host = 'localhost') {
return new Promise(res => {
const s = net.createServer()
s.once('error', () => res(false))
s.once('listening', () => s.close(() => res(true)))
s.listen(port, host)
})
}
if (!(await portFree(9000))) console.warn('port 9000 busy; pick another start port') Try / catch
try {
port = await openPort({ port, host })
} catch (err) {
if (err.message === 'ERROR_NETWORK_PORT_NOT_AVAIL') {
// inspect listeners / restart network stack / pick another interface
} else throw err
} Prevention
- Start scans from a low, rarely-used base port (e.g. 9000)
- Monitor listening sockets in CI to catch port leaks
- Pin hosts explicitly instead of relying on default interfaces
- Restart containers/machines with high uptime where ephemeral ports may be exhausted
When it happens
Trigger: Calling openPort/findClosestOpenPort with a starting portProposal such that every port from it through 65535 fails isPortAvailable (already bound, permission-restricted, or otherwise unbindable) on the target host.
Common situations: Running many dev servers simultaneously on one machine exhausting ephemeral/high ports; a misconfigured host string (e.g. wrong interface) making every bind fail; containers/CI with restricted networking; a port-scan-happy firewall or a leaked process holding thousands of sockets.
Related errors
- ERROR_NETWORK_PORT_NOT_AVAIL
- Unknown network error occurred
- ️️Setting port to closest one available: ${openPort}
- Network error encountered while following the quasar.config
- Registry responded with ${response.status}
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/1e760dd94973ce06.
Report an issue: GitHub.