XX-net/XX-Net · warning
Can't found acceptable ports
Error message
Can't found acceptable ports
What it means
change_reserved_port_range() found no acceptable alternative TCP dynamic port range via search_port_range(), so it refuses to run the elevated 'netsh int ipv4 set dynamic tcp start=... num=...' command and returns None. It is a warning: nothing is modified and the caller (check_and_resolve) must handle the None result.
Source
Thrown at code/default/launcher/win_compat_suggest.py:124
return False
def search_port_range(self):
port_number = 16384
for port_start in range(10000, 45000, 5000):
port_end = port_start + port_number
acceptable = True
for port in self.service_ports:
if port_start <= port <= port_end:
acceptable = False
break
if acceptable:
return [port_start, port_number]
def change_reserved_port_range(self):
ports = self.search_port_range()
if not ports:
xlog.warn("Can't found acceptable ports")
return
exec = b"netsh"
args = b"int ipv4 set dynamic tcp start=%d num=%d" % (ports[0], ports[1])
import win32elevate
win32elevate.elevateAdminRun(args, exec)
@staticmethod
def notify(title="Title", msg="msg"):
import ctypes
res = ctypes.windll.user32.MessageBoxW(None, msg, title, 1)
# Yes:1 No:2
return res
def get_process_list():
process_list = []
if os.name != "nt":View on GitHub (pinned to cfa5bc17b6)
Solutions
- Run 'netsh int ipv4 show excludedportrange protocol=tcp' and inspect how much of the range is blocked; reboot can clear ephemeral Hyper-V reservations.
- Freeze fewer ports or shrink the number of ports search_port_range demands so a window can be found.
- Manually reserve a safe range with an admin shell: netsh int ipv4 set dynamic tcp start=49152 num=16384, then re-run check_and_resolve.
- Disable Hyper-V/WSL if its reservations are consuming the entire dynamic range.
Example fix
// before
def change_reserved_port_range(self):
ports = self.search_port_range()
if not ports:
xlog.warn("Can't found acceptable ports")
return
// after
def change_reserved_port_range(self):
ports = self.search_port_range()
if not ports:
xlog.warn("Can't found acceptable ports; try shrinking port_number or freeing excluded ranges")
return None
return ports Defensive patterns
Strategy: fallback
Validate before calling
ranges = subprocess.check_output(
'netsh int ipv4 show excludedportrange protocol=tcp', shell=True)
excluded = sum(int(l.split()[1]) - int(l.split()[0])
for l in ranges.decode(errors='ignore').splitlines()
if len(l.split()) == 2 and l.split()[0].isdigit())
if excluded > 14000: # nearly whole dynamic range blocked
raise RuntimeError('Port space exhausted; reboot or disable Hyper-V reservations') Prevention
- Check excludedportrange output before attempting to relocate the dynamic range.
- Keep the requested port_number small so a free window is easier to find.
- Reboot to clear transient Hyper-V/WinNAT reservations before re-running.
When it happens
Trigger: Calling check_and_resolve() (or change_reserved_port_range directly) when every candidate port range either overlaps a service port or falls inside Windows excluded port ranges, so search_port_range() returns an empty list.
Common situations: Hyper-V/WSL/Docker reserving most of the dynamic port range; a machine with many excluded ranges leaving no window for the ~10k-port dynamic range; overly strict search criteria in search_port_range; service ports sitting inside every candidate window.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/0a6c050891a0d9b7.
Report an issue: GitHub.