Connectivity Troubleshooting · Clash Technical Blog

How do you fix a Mihomo OpenVPN tls-auth handshake timeout?

Older Mihomo versions may time out after 4 retransmissions when an OpenVPN outbound uses both tls-auth and a non-SHA1 auth algorithm. This guide explains how to upgrade to v1.19.31, verify the fix with the same configuration, and roll back safely if the upgrade fails.

  • Mihomo
  • OpenVPN
  • tls-auth
  • Handshake timeout
  • v1.19.31
On this page

First confirm whether this OpenVPN handshake bug matches your case

Mihomo issue #2992 documents a very narrow combination: an OpenVPN outbound uses tls-auth while auth is set to SHA512.

The configuration loads, DNS resolution succeeds, and the PROCESS-NAME rule matches, but the control channel times out after 4 retransmissions. The client log contains make OpenVPN handshake: read hard reset response after 4 retransmits: context deadline exceeded.

The reported environment was Windows 11 with Mihomo v1.19.29. HTTP requests could return 502, while HTTPS stopped receiving TLS data after the proxy accepted CONNECT. In the same Mihomo environment, another OpenVPN configuration without tls-auth worked.

This comparison supports checking tls-auth and auth before blaming DNS, routing, or the entire proxy entry point.

PR #3189 confirms that the old implementation fixed the HMAC digest for tls-auth control packets to SHA1. If the server validates them with another auth digest such as SHA256, SHA384, or SHA512, it discards the first control packet because the tag length differs.

If you can read the server log, you may see TLS Error: cannot locate HMAC in incoming packet. Servers using SHA1 are not affected by this specific defect, and ordinary TLS, certificate, port, or network errors are outside this guide's conclusion.

Quick scope check

Observed conditionDoes it match?Diagnostic direction
type: openvpn, tls-auth, and a non-SHA1 auth are all presentStrong matchContinue by checking the version and exact log message
The log contains 4 retransmits and context deadline exceededMatches when combined with the field checkBack up the installation, then upgrade to v1.19.31
Only tls-crypt or tls-crypt-v2 is usedDoes not matchTroubleshoot the relevant key, certificate, and server settings
auth is SHA1Not this root causeDo not attribute every handshake timeout to this fix
DNS does not resolve, the rule does not match, or the port is unreachableInsufficient evidenceFix the failure at the earlier connection stage first

Check tls-auth, auth, and key-direction using a redacted copy

Create a separate troubleshooting copy of the configuration instead of editing the live file. Confirm that the proxy is type: openvpn, then record auth, whether tls-auth is present, key-direction, proto, the port, and the server domain.

The official documentation states that tls-auth is mutually exclusive with tls-crypt and tls-crypt-v2. With tls-auth, key-direction supports 0 or 1. auth supports MD5, SHA1, SHA256, SHA384, and SHA512, with SHA256 as the default.

Do not post the tls-auth static key, username, password, client private key, full certificate contents, or real server address in a public issue. Public evidence should contain only field names, the digest algorithm, a redacted address, the error time, and the first relevant log line. Keep the original configuration private.

Do not delete tls-auth, guess key-direction, or downgrade the server's auth to SHA1 for testing. Doing so changes the authentication boundary, cannot prove whether the upgrade fixed the original problem, and may make the client configuration inconsistent with the server.

Record the version and inspect the candidate configuration without changing it
mihomo -v
mihomo -t -f /path/to/config.yaml

Field checklist

  • The running core version and build architecture have been recorded
  • The target proxy is explicitly type: openvpn
  • tls-auth and auth are both present, and auth is not SHA1
  • key-direction matches the original .ovpn file or server configuration
  • tls-auth is not configured together with tls-crypt or tls-crypt-v2
  • The public record omits the static key, account details, private key, certificate contents, and real address

First rule out earlier DNS, routing, and port failures

A handshake error only means the OpenVPN control channel did not complete; it does not prove the cause by itself. First confirm that the server domain resolves, the target UDP or TCP port is reachable, the request actually matches this OpenVPN outbound, and a known-good outbound remains available for comparison.

If the log already shows an earlier error during resolution, dialing, certificate loading, or configuration validation, address that error first. The diagnostic sequence in issue #2992 applies only when DNS and routing both succeed, the connection reaches the OpenVPN handshake, and a hard reset timeout appears after 4 retransmissions.

Use the same server, the same redacted configuration, and the same HTTPS target before and after the upgrade. If you also change the node, protocol, port, certificate, and auth during testing, a recovered connection cannot be attributed to v1.19.31.

The configuration test fails or a field is unsupported

Fix the YAML and current version's supported fields before drawing any handshake conclusion.

The server domain does not resolve

Check DNS, proxy-server-nameserver, and the system network first.

The rule does not match the OpenVPN outbound

Pin the test policy and confirm the actual outbound in Connections or the log.

The port is immediately refused or remains unreachable

Check the server, port, firewall, and proto; do not label it an HMAC digest problem.

The connection reaches the handshake, then shows 4 retransmits, and the field combination also matches

Save the baseline and continue with a v1.19.31 version comparison.

Back up the configuration and old core before upgrading

v1.19.31 is the stable release that includes the PR #3189 fix. Before upgrading, record the current binary's full version output, operating system, CPU architecture, managing client or service manager, and the core file's actual location.

Make a complete private backup of the configuration, referenced certificate files, and old core binary. If you use a graphical client, also record its core-update entry point and automatic-update policy; the application version and the running Mihomo version are not always the same.

For a remote device, router, or unattended host, first confirm that you have a management path that does not depend on this OpenVPN outbound. Do not replace the core through the only available connection without a fallback path.

Establish a Rollback Baseline

  1. Record the running version

    Save mihomo -v or the client's core information, and record the system, architecture, and management method.

  2. Copy the complete configuration

    Back up the YAML and referenced files. Keep the original tls-auth key, account details, and private key only in the private copy.

  3. Keep the old core

    Copy the current executable and label it with its version. Do not overwrite the only rollback copy with the new file.

  4. Fix the validation target

    Record the policy group, OpenVPN outbound, the same HTTPS address, and the exact pre-upgrade error.

  5. Confirm backup management access

    For remote environments, first ensure that the console, a direct connection, or another verified outbound remains available.

Upgrade to v1.19.31 from the official Release

Mihomo v1.19.31 was released on 2026-9-14. The Release explicitly includes commit 6d179a1c, which makes the HMAC digest used by OpenVPN tls-auth follow auth instead of remaining fixed to SHA1.

The minimum target is to actually run v1.19.31. If you use a later stable release, confirm that it includes the 6d179a1c fix. Updating only the graphical client interface or subscription does not upgrade the core.

If you run Mihomo directly, choose the asset from the official MetaCubeX/mihomo v1.19.31 Release that matches your operating system, CPU architecture, and build variant, then verify the SHA256 listed for that asset on the Release page.

If Clash Verge Rev, OpenClash, or another frontend manages the core, use that project's official core-update entry point and read the actual running version again afterward.

Stop the old core before replacing the file, and preserve its permissions, startup arguments, and service configuration. Do not mix individual files from different versions, and do not obtain a same-named core from search ads, file-sharing services, or unknown mirrors.

Complete a verifiable upgrade

  1. Choose the correct asset

    The system, architecture, and build variant must match the current environment. Save the official file name and SHA256.

  2. Stop the old instance

    Use the current management tool to stop the core cleanly so the old and new processes do not read and write the configuration simultaneously or contend for ports.

  3. Replace the core or apply the update

    Update the complete core using the existing installation method without changing the authentication fields in the original OpenVPN Profile.

  4. Test the configuration first

    Confirm that v1.19.31 can load the original configuration, then start the service and inspect the first log entry.

  5. Read the actual running version

    Confirm again through the command line, API, or client core information that the current process is v1.19.31, or a later stable release confirmed to include the fix.

Verify the fix with the same OpenVPN Profile

After upgrading, the decisive result is not a success message in the interface but whether the same server, same Profile, same auth, and same tls-auth complete the control-channel handshake. First pin the policy-group selection so a request clearly uses the target OpenVPN outbound, then visit the same HTTPS target used before the upgrade.

Confirm that the log no longer contains read hard reset response after 4 retransmits and that the request receives a real HTTPS response. Also test an ordinary outbound to ensure the core upgrade did not break other paths. If you need UDP, perform a separate real UDP workload test; a latency number is not a substitute.

Do not count a successful test after disabling tls-auth, changing auth to SHA1, or switching to another server as verification of the fix. Those changes only prove that a different configuration works; they do not prove that v1.19.31 fixed the original combination.

Set the port to the current HTTP or mixed-port, and make sure the policy selects the target OpenVPN outbound
curl -I -x http://127.0.0.1:7890 https://example.com

v1.19.31 fix acceptance checklist

  • The actual running version is v1.19.31, or a later stable release confirmed to include the fix
  • The configuration, server, auth, tls-auth, and key-direction were not changed for the test
  • The test request actually uses the target OpenVPN outbound
  • The log no longer shows the hard reset handshake timeout after 4 retransmits
  • The same HTTPS target returns a valid response rather than merely accepting a connection to the local proxy port
  • Ordinary outbounds and basic networking still work; if UDP is needed, a separate real UDP test has been completed
  • The old core, private configuration backup, and rollback procedure remain available

If v1.19.31 still fails, stop applying this root cause

If the actual running version is v1.19.31 or a later stable release confirmed to include the fix, but the handshake still fails, do not keep attributing every error to the old fixed-SHA1 behavior. First compare whether the error is still identical, whether the request still uses the same outbound, and whether the server also reports an HMAC, certificate, key-direction, or authentication failure.

Recheck ca, cert, key, tls-auth, key-direction, auth, proto, the port, and the system time. Confirm that tls-auth is not combined with tls-crypt or tls-crypt-v2. If the server configuration or keys changed recently, use the server's current configuration rather than guessing from an old client file.

Only continue troubleshooting from a new first error if the original error disappears and is replaced by a different, explicit error. Repeatedly changing the digest, key-direction, and certificate breaks the version comparison and may trigger the server's failure protections.

The version still reports v1.19.30 or earlier

Fix the core-update path; the current process is not yet using a version that contains the fix.

The rule sends traffic through DIRECT or another proxy

Restore an explicit test policy; do not judge the OpenVPN result through the wrong outbound.

The server reports incoming packet authentication failed

Check the tls-auth key and key-direction; do not regenerate or disclose the key.

A certificate, private-key, or CA error appears

Switch to certificate-chain and client-identity troubleshooting; the HMAC root cause in this guide no longer applies.

The same 4 retransmits remains, and both the fields and version match

Save the minimal redacted configuration, the first relevant log from both ends, and the version, then submit reproducible evidence to the Mihomo project.

Roll back if the upgrade causes problems, but do not weaken authentication

If v1.19.31 introduces another startup or compatibility problem on this device, stop the new core, restore the complete old binary and original configuration saved before the upgrade, and start it through the same management entry point. After rollback, first confirm the version and configuration load, then test an ordinary outbound and the device-management path.

The old core reintroduces the non-SHA1 tls-auth handshake problem described here, so it is not a long-term fix for this OpenVPN Profile. If service must be restored immediately, switch to another verified node or protocol, or temporarily disable this Profile. Do not delete tls-auth, guess key-direction, or lower the server's auth to accommodate the old client.

When upgrading again, continue to use the same redacted baseline, official asset, and real request. An upstream report should include the system, architecture, full version output, field combination, first relevant log before and after the upgrade, and minimal reproduction steps, but it must never include the static key, account details, private key, or real service address.

Safe rollback completion criteria

  • The old core and original configuration were restored as a complete set without mixing old and new components
  • Ordinary outbounds, basic connectivity, and the device-management path have been restored
  • The affected OpenVPN Profile is disabled or explicitly marked as still unresolved
  • tls-auth was not deleted, key-direction was not changed, and the server's auth was not weakened
  • The v1.19.31 asset, logs, and failure symptoms have been preserved for a later retest
  • Public reports use only redacted copies and contain no authentication material

References