Troubleshooting

How to Read Clash Logs: Common Errors and How to Troubleshoot Them

Learn what Clash log levels mean and how to troubleshoot common errors, including dial tcp timeouts, DNS failures, unmatched rules, and port conflicts.

Log levels: use info by default; switch to debug when reproducing an issue

Runtime logs record events observed by the active core. A failed subscription update, an error in the client interface, and a core forwarding failure may have different causes. First, check the core name and version shown in the client, along with the name of the active configuration. The original Clash and mihomo do not use identical log messages, support the same fields, or offer all the same features. The examples below focus on common mihomo configuration and error keywords. Log snippets are illustrative, not from live testing.

Check the top-level field log-level: info in the active configuration. If your client supports persistent overrides, use one to adjust the subscription configuration, then confirm it reloads successfully. When reproducing the issue, note the time—for example, 14:32:08—and open just one page that fails. Look for entries from the same time and destination port. Node health checks and browser background sync generate their own connections; don't mistake their errors for the result of your test.

dial tcp timeouts: first identify the dialed address

dial tcp 192.0.2.10:443: i/o timeout means the TCP connection to that address didn't complete before the deadline. The IP here is an example for documentation. In a real log, first check whether the connection used DIRECT or a proxy group, then compare the reported address and port with the node's server and port settings. An outer connection entry may show the website's domain, while the actual dial is to the node server.

  1. It's dialing the node address: Keep the destination URL and network unchanged, and switch to another node in the current group. If the same URL works through another node, focus on the original node or the network path to it. If the same node times out only on a particular Wi-Fi network, compare results on another network using the same device.
  2. It's dialing the destination directly: Check that DIRECT is what the rules call for, then see whether the destination is reachable on the same network and whether the failed address is IPv4 or IPv6. A single timed-out IPv6 dial doesn't prove the overall request failed; check for a subsequent successful connection.
  3. It's not a timeout: connect: connection refused means the connection was explicitly rejected, so check the port and listener first. If the log reports x509 or tls handshake after dialing, investigate the system clock, certificate, server name, and handshake settings instead of blindly increasing the timeout.

DNS failures: distinguish system, core, and node-domain lookups

If you see no such host or dns resolve failed, note the name that failed to resolve. If it's the server domain for a subscribed node, investigate node-domain resolution first. If it's the website's domain, check which side handled DNS for that request. A DNS error explains the failure only when both the domain and timestamp match.

With enhanced-mode: fake-ip enabled, getting an address from the configured fake IP range is expected. For example, if fake-ip-range is 198.18.0.1/16, a result of 198.18.0.12 doesn't mean public DNS returned a bad record. Next, confirm the following connection reached the core handling that mapping, and check whether the connection entry links back to the original domain.

Unmatched rules: distinguish traffic that never reached the core from traffic sent to the fallback

If info shows a connection entry with MATCH, then in rule mode none of the earlier rules matched. If there's no entry for the connection at all, check the traffic path first: the system proxy only covers apps that use its settings, and some apps or UDP traffic may take another route. With TUN, confirm it's running, the destination route goes through TUN, and the traffic isn't excluded. Prove traffic is reaching the core before changing rules.

In rule mode, rules are checked in order, and the first match takes effect. This snippet assumes Proxy-Group is defined in the configuration and uses MATCH as the final fallback:

mode: rule
rules:
  - DOMAIN,api.example.com,DIRECT
  - DOMAIN-SUFFIX,example.com,Proxy-Group
  - MATCH,Proxy-Group

A request for api.example.com that reaches the core with its domain intact should match the first rule. Move the suffix rule to the top, and the same request will go to the proxy group. Also check that the client hasn't switched to Global or Direct mode. If a connection only shows the destination IP and the core can't recover the domain from a DNS mapping or enabled sniffing, domain rules have nothing to match against. After editing the configuration, test with a new connection; existing connections can't confirm whether the new rule works.

Port conflicts: identify the listener and process before changing proxy ports

If startup logs show listen tcp 127.0.0.1:7890: bind: address already in use, the TCP listener couldn't bind to that address. The example uses 7890; use the port shown in your own log. Check whether the error refers to mixed-port, external-controller, or dns.listen. Changing the wrong field leaves the conflict in place and may point the system proxy at the wrong port.

If another running client is using the port, quit that client normally and try loading the configuration again. If another service needs to keep the port, assign a free port to the conflicting listener and update any settings that depend on it. For example, if you change the mixed port from 7890 to 7897, update any manually configured system or app proxy to use 7897 too. After restarting, confirm the listener starts successfully, then make a new request.

Retest in order: listener, traffic path, rules, outbound connection

  1. Fails at startup: Start with the first configuration-loading or listener error. If the message gives a YAML line number, check that line and the indentation, colons, and list structure just above it. Then confirm you're editing the active configuration.
  2. Starts successfully, but there's no matching connection: Check the proxy address and port the app is actually using. For apps routed through TUN, check the interface and routes. Don't switch nodes before the traffic path is working.
  3. Connection appears, but the policy is wrong: Note the mode, destination domain or IP, matched rule, and node actually selected within the group. Then check rule order and configuration overrides.
  4. Policy is right, but the connection fails: Read the innermost error and find the first failing stage: DNS resolution, TCP dialing, or the handshake. Change one thing at a time, retest the same destination, and keep the relevant logs from before and after each change.

When asking for help, include your operating system, client and core versions, current mode, whether TUN is enabled, and a few log lines around the time you reproduced the issue. Keep the error type, destination port, and rule type; redact subscription URLs, access tokens, node credentials, and any addresses you don't want to share. This is usually enough to tell whether the problem is with the traffic path, rules, or outbound connection.

Download Clash