Troubleshooting 9 min read

Port 7897 Already in Use: Find the Process and Change the Listening Port

Find the process using a port on Windows, macOS, or Linux, then change the mixed port in the client and update your system proxy.

First, determine whether port 7897 failed to bind or the connection failed

Clash Verge Rev’s mixed port corresponds to mixed-port in the mihomo configuration. This single listening endpoint accepts both HTTP proxy and SOCKS5 connections. This guide uses 7897 as the port to investigate and 7898 as an example replacement. The actual values depend on your client settings and core logs; these example ports are not fixed defaults for every installation.

A port conflict occurs while binding a local listening socket. Typical signs include the client opening normally while the core log reports bind, address already in use, or, on Windows, “Only one usage of each socket address is normally permitted.” A successful subscription update or normal node latency does not prove that the local proxy endpoint is available.

listen tcp 127.0.0.1:7897: bind: address already in use

The error above is a typical example; the exact wording may vary. First, look for 7897 and bind on the “Logs” page, then use the table below to identify the issue. This helps avoid treating every network error as a port conflict.

Log or symptomCheck first
address already in useA process listening on the same address and port, including wildcard-address listeners
connection refusedWhether a service is actually listening at the address and port the application connects to
access permissions / permission deniedReserved ports, permission restrictions, or security software policies
Connection established, then timed outNodes, rules, DNS, and the destination site—not just the local port

Windows: Find the Listening Process with PowerShell

Step 1: Check for a Local Listening Port

Open PowerShell and run the command below. If a regular terminal does not show complete results, reopen it as an administrator. This filters for the local port and the Listen state, so connections to remote port 7897 are not mistaken for a local conflict.

Get-NetTCPConnection -LocalPort 7897 -State Listen -ErrorAction SilentlyContinue |
  Select-Object LocalAddress, LocalPort, State, OwningProcess

The OwningProcess column contains the process ID (PID). Note the number shown, then look up the process name and path. The command below collects the PID of the listener; it uses $ownerPid—do not assign a value to PowerShell’s built-in $PID variable.

$owners = Get-NetTCPConnection -LocalPort 7897 -State Listen -ErrorAction SilentlyContinue |
  Select-Object -ExpandProperty OwningProcess -Unique

foreach ($ownerPid in $owners) {
  Get-Process -Id $ownerPid |
    Select-Object Id, ProcessName, Path
}

Step 2: Check Whether It Belongs to Another Client Instance

If the process is mihomo or another proxy client, check the system tray and Task Manager first. Closing a window does not necessarily quit the program; it may still be running in the background. In service mode, the core may be managed by a system service. Use the client’s “Quit” option or its service management controls to stop it rather than force-ending a process based on its name alone.

If the process exits and immediately reappears with a new PID, a background service or launcher is probably restarting it. Repeatedly ending the process will not resolve the conflict; stop the associated service or configure the two programs to use different ports. Do not end every process whose name contains proxy, clash, or mihomo.

No Listening Process Found, but the Bind Still Fails

First, confirm the address and protocol in the error. The IPv4 address 0.0.0.0:7897 listens on all IPv4 interfaces, not just LAN addresses, and may also conflict with a loopback listener. If the log explicitly reports an access-permission error, check the Windows TCP excluded port ranges:

netsh interface ipv4 show excludedportrange protocol=tcp
netsh interface ipv6 show excludedportrange protocol=tcp

If 7897 falls within an excluded range, use a port outside that range with no listener. Do not delete system exclusions just to resolve a proxy port issue. Virtualization, containers, and network components may rely on them.

macOS and Linux: Identify the Process by PID

macOS: Use lsof to Check TCP Listeners

Open Terminal and run the command below. -nP keeps addresses and ports numeric, while -sTCP:LISTEN lists listening sockets only. Using sudo can help avoid missing processes owned by other users due to insufficient permissions.

sudo lsof -nP -iTCP:7897 -sTCP:LISTEN

In the output, COMMAND is the program name, PID is the process ID, and NAME is the listening address. To view the full command used to start the process, enter the PID you found and run the following query:

read -r owner_pid
ps -p "$owner_pid" -o pid=,user=,command=

Once you confirm it belongs to an old client, quit that program from the menu bar. If a background service started it, identify the service before stopping it. Avoid terminating system processes or programs of unknown origin; you can instead assign Clash Verge Rev a free port.

Linux: Use ss to Check Listeners and Processes

Run the command below in a terminal. -l lists listening sockets, -t selects TCP, -n uses numeric addresses, and -p shows associated processes. Process details usually require administrator privileges.

sudo ss -ltnp 'sport = :7897'

If the result points to a proxy service managed by systemd, stop it using the service’s own controls. Killing only the core process may cause it to restart automatically. If the log explicitly reports a UDP bind conflict, check UDP separately; a TCP port and a UDP port with the same number are not automatically the same conflict:

sudo ss -lunp 'sport = :7897'
  • No output: No matching listener was found in this query. That does not mean the port will always be available; another program may bind to it first the next time it starts.
  • Listening on 127.0.0.1: This is generally for local use only; there is no need to expose it to external interfaces to resolve a conflict.
  • Listening on 0.0.0.0 or [::]: The listener uses a wildcard address. IPv6 dual-stack behavior depends on the system and socket options, so check the actual logs.

Change the Mixed Port: Switch from 7897 to 7898

There are two options: stop the program using the port and keep 7897, or leave the existing program running and move Clash Verge Rev to another free port. If both clients need to run at the same time, the second option is more straightforward. You should also make sure they do not repeatedly overwrite the system proxy settings.

  1. Use the system command for your platform to check 7898 first and confirm there is no matching listener. On Windows, also check whether it falls within an excluded port range.
  2. Open Clash Verge Rev, go to “Settings,” and find the “Mixed Port” field under “Clash Settings.” Depending on the version, the field may appear in a settings dialog or port settings section; use the interface label “Mixed Port” to locate it.
  3. Change 7897 to 7898 and save. If prompted to restart the core, follow the prompt, then confirm the new listening address on the “Logs” page.
  4. Check for listeners on 7898 again and confirm the process belongs to the core used by the current client, not another program.

The corresponding field in the mihomo YAML is shown below. This illustrates what the field means; you do not need to edit your subscription file:

mixed-port: 7898

Clash Verge Rev may override general fields from a subscription through its client settings. Editing a downloaded YAML file directly may not determine the final listening port, and subscription updates may overwrite manual changes. Use the client’s settings wherever possible, then verify the effective value in the startup log and the operating system’s listener list. For managing overrides, see Advanced Config.

Update the System Proxy, Terminal Variables, and App Settings

One of the most common oversights after changing ports is that the core listens on 7898 while an application still connects to 7897. A port change requires checking both the listening end and the client end. The client can update the system proxy it manages, but that does not automatically update browser extensions, terminal environment variables, or developer tools with manually configured proxies.

Reapply the System Proxy

After saving the new port, turn “System Proxy” off and back on in “Settings” so the client rewrites the proxy address. Then verify it in your system settings: on Windows 11, go to “Settings” → “Network & internet” → “Proxy”; on macOS, go to “System Settings” → “Network” → your current network connection → “Details” → “Proxies.” The system proxy settings on Linux vary by desktop environment, and some apps do not use the desktop proxy.

The local proxy address is usually 127.0.0.1, and the port should match the new listening port. HTTP and HTTPS traffic can both be forwarded through the same HTTP proxy endpoint; this does not mean the local proxy address needs an https:// prefix. If another client also has its system proxy enabled, turn that feature off in the other client to prevent the settings from being overwritten back and forth.

Check Terminal and Developer Tool Settings Separately

An existing terminal session may still have the old HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY value. The commands below change only the current terminal session and do not permanently alter system settings:

# macOS / Linux: current shell session
export HTTP_PROXY=http://127.0.0.1:7898
export HTTPS_PROXY=http://127.0.0.1:7898
export ALL_PROXY=socks5h://127.0.0.1:7898
# Windows PowerShell: current session
$env:HTTP_PROXY = "http://127.0.0.1:7898"
$env:HTTPS_PROXY = "http://127.0.0.1:7898"
$env:ALL_PROXY = "socks5h://127.0.0.1:7898"

Whether an app reads these variables depends on how it is implemented. Browser proxy extensions, Git proxy settings, editor network settings, and container environments may all have separate values. Check each item still using 7897 rather than simply restarting the browser.

TUN Mode Is Not the Mixed Port

TUN mode routes traffic through a virtual network interface, while the mixed port is a local proxy endpoint that applications connect to directly. Changing mixed-port does not automatically update TUN routes or DNS settings. An app explicitly configured to use the old proxy port may still fail to connect even when TUN is enabled. Enabling TUN is not a fix for a port conflict.

Verify the New Port: Check the Listener, Then Test a Request

Verify the setup in stages. First confirm the port belongs to the correct core, then send a request with the proxy explicitly specified. Do not assume the problem is fixed just because a webpage loads: it may be cached or reached through a direct connection or another network path.

  1. Run the listener check for your operating system again, replacing the port with 7898, then verify the process and listening address.
  2. Check the “Logs” page and make sure no new bind errors appear after the reload.
  3. Run the HTTP proxy test below, then check the request destination and rule match on the “Connections” page.
# macOS / Linux
curl --noproxy "" --proxy http://127.0.0.1:7898 --connect-timeout 5 --max-time 15 -I https://example.com

# Windows PowerShell
curl.exe --noproxy "" --proxy http://127.0.0.1:7898 --connect-timeout 5 --max-time 15 -I https://example.com

The connection timeout is 5 seconds and the overall timeout is 15 seconds; these are test settings, not measured latency. --noproxy "" prevents an existing proxy bypass list from affecting the test. Receiving an HTTP response means the request was handled through the local proxy endpoint, but the status code is not necessarily 200. The rule may also route the destination directly, so check the connection details.

If you immediately get a connection error for 127.0.0.1:7898, go back and check the listener. If the local proxy connection succeeds but you then see a TLS, DNS, or upstream timeout, investigate the node, DNS resolution, and rules instead. Repeatedly changing the local port is unlikely to help at that point.

More Troubleshooting: Still Getting Errors After Changing the Port?

Does seeing multiple entries for 7897 mean multiple programs are in conflict?

Not necessarily. A single PID may listen on both IPv4 and IPv6, or there may be multiple established connections. Focus on the listener state, address, protocol, and PID—not just the number of output lines. TCP TIME_WAIT entries are not active listening processes.

Can I just quit the client and reopen it?

You can do that as part of troubleshooting, but it does not replace checking the results. The client may remain active in the system tray or service mode, or another client may keep the core running. Check the port after quitting to confirm the listener was actually released, then check the new listener after reopening.

Will enabling “Allow LAN” fix the port conflict?

Do not treat it as a general fix. This setting changes the listening scope and may expand it from the loopback address to more interfaces, potentially creating additional conflicts. For local use, keep the listener limited to the local machine. Sharing access over a LAN also requires considering firewall rules and access controls.

Do I need to reinstall the client or delete my subscription?

Usually not. Subscriptions provide nodes and rules; a port conflict occurs locally while binding a socket. First identify the listening process, choose a free port, update every proxy client, and test a request. Only investigate the relevant component further if you confirm an issue with the installation or service itself. Do not start by clearing all settings.

Download Clash Clients