This guide is for v2rayN, v2rayNG, and v2flyNG users seeing failed latency tests, interrupted TLS handshakes, or certificate-invalid warnings. Check system time first, then the node address and SNI, certificate validity, the full certificate chain, and client core logs to determine whether the cause is local configuration, subscription data, or server-side certificate deployment.
Where does the TLS error occur?
When V2Ray or Xray establishes a TLS connection, the client first connects to the node's IP address and port, then sends a ClientHello containing SNI. The server selects a certificate based on the SNI, after which the client checks its validity period, hostname coverage, issuing chain, and system trust. If any check fails, the connection stops before the proxy protocol begins.
A TLS error in the log therefore does not necessarily mean that the VMess or VLESS user identifier is wrong. The user identifier, encryption method, and flow-control settings typically come into play only after the TLS handshake completes. Troubleshoot the certificate layer first instead of changing the UUID, port, transport, and routing rules all at once.
Step 1: Correct the system time and time zone
A certificate contains explicit validity and expiration times. The client uses the local clock to determine whether the current time falls within that window. An incorrect date, wrong time zone, or a clock that fails to resynchronize after sleep can make a valid certificate appear not yet valid or expired. Dual-boot systems, desktops that stay powered off for long periods, and devices with automatic time disabled are especially prone to this issue.
Error: x509: certificate has expired or is not yet valid
Cause and fix: The local time is outside the certificate's validity window, or the server certificate has actually expired. Enable automatic time synchronization and sync immediately, then restart the client core. If the error remains after the clock is correct, check the certificate dates on the server.
Error: certificate invalid
Cause and fix: This is a general certificate-validation failure. Check whether the next log line contains expired, not yet valid, unknown authority, or hostname, then follow the corresponding troubleshooting path.
-
Check the current time
Compare the year, month, day, hour, and minute with a trusted time source. If the clock is off by 5 minutes or more, fix system time before changing any node parameters.
-
Confirm the local time zone
In Windows, open Settings → Time & language → Date & time. Confirm that the time zone matches your location and enable Set time automatically.
-
Sync immediately
On the Date & time page, open Additional settings and sync now. In one troubleshooting case, correcting a 7-minute-12-second drift immediately cleared the not-yet-valid certificate warning.
-
Restart the client core
In the v2rayN main window, select Servers → Restart service, then test the current server's latency again so an old failed connection is not reused.
Android devices also require automatic time and time-zone settings to be checked under Date & time. Manually adjusting the minutes is not reliable because an incorrect date or time zone can still affect certificate validation. After synchronizing the clock, fully exit v2rayNG or v2flyNG, reopen it, and test the node again.
Step 2: Check SNI, serverName, and the node address
SNI is the hostname sent to the server during the TLS handshake. In V2Ray and Xray configurations, it is usually set by serverName. When it is not specified, the core may derive it from the node address. If the node address is an IP, the entry hostname differs from the certificate hostname, or SNI was lost during subscription conversion, the server may return its default certificate and trigger a hostname mismatch.
Three fields must be kept separate: the node address determines where to connect, the port determines the connection entry point, and serverName determines which hostname is declared during the TLS handshake. A WebSocket Host header is sent after TLS is established and cannot replace SNI. If Host is correct but serverName is wrong, certificate validation will still fail.
| Configuration field | When it applies | How to fill it in | Typical mistake |
|---|---|---|---|
| Address | Establishing the TCP connection | The entry hostname or IP supplied by the subscription | Extra spaces after copying or an outdated entry point |
| Port | Connecting to the service entry point | Match the node configuration, such as 443 | Treating a non-TLS port as a TLS port |
| serverName | TLS ClientHello | Enter the full hostname covered by the certificate | Entering an IP, an old hostname, or leaving it blank and getting a wrong derived value |
| Host | HTTP or WebSocket request | Enter the application-layer hostname specified by the node parameters | Assuming Host automatically replaces SNI |
Error: x509: certificate is valid for node.example.com, not edge.example.net
Cause and fix: The current serverName does not match a hostname covered by the certificate. Change the node's TLS serverName to the certificate hostname supplied by the subscription; do not guess from the node label or latency-test hostname.
Error: remote error: tls: handshake failure
Cause and fix: The server rejected the current handshake parameters, commonly because of an incorrect SNI, port, or TLS setting for the entry point. Check the address, port 443, transport security type, and serverName, then try again.
In a typical VLESS TLS outbound configuration, the address and serverName can differ. The example below shows only how the fields relate; the actual address, user identifier, port, and transport must come from a valid subscription.
{
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "edge.example.net",
"port": 443,
"users": [
{
"id": "11111111-2222-3333-4444-555555555555",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"security": "tls",
"tlsSettings": {
"serverName": "node.example.com"
}
}
}
]
}
Step 3: Check certificate validity and the complete chain
Once system time and SNI match, errors such as unknown authority or unable to verify certificate point to the certificate chain returned by the server. Normally, the server sends the site certificate along with the required intermediate certificates, allowing the client to validate it through a trusted root certificate. If an intermediate certificate is missing, some environments with cached certificates may work temporarily while other devices fail consistently.
Error: x509: certificate signed by unknown authority
Cause and fix: The client cannot link the site certificate to a trusted root certificate. Update the system certificate store and check that the server sends the complete intermediate chain; do not deploy only the leaf certificate.
Error: tls: failed to verify certificate
Cause and fix: Certificate validation failed. Read the rest of the same log line and use hostname, expired, or unknown authority to determine whether the issue is the hostname, date, or trust chain.
Error: unexpected EOF during TLS handshake
Cause and fix: The remote end closed the connection before the handshake completed. Confirm that the connection is going to a TLS port and check whether the server's reverse proxy accepts connections for the current SNI.
With a command-line environment, use OpenSSL to inspect the certificate chain returned by the target entry point. -connect specifies the actual address and port, while -servername specifies the SNI. Keeping them separate makes it easier to verify configurations where the entry hostname and certificate hostname differ.
openssl s_client \
-connect edge.example.net:443 \
-servername node.example.com \
-showcerts
- In the output, check the site certificate's subject hostname and confirm that it covers
node.example.com. - Check Not Before and Not After on the certificate and confirm that the current time falls within the validity window.
- Check that Certificate chain contains the site certificate and the required intermediate certificates, rather than only a single certificate numbered 0.
- Confirm that the final verification result is successful. If the chain is incomplete, the server must add the missing intermediate certificates and reload the entry-point configuration.
- If multiple nodes share one entry point and fail at the same time, check certificate renewal and reverse-proxy configuration first instead of editing each client node.
End users usually cannot repair a server-side certificate chain. Preserve the node name, test time, first error log, and network in use, then update the subscription once and test again. If the same chain error appears across different networks and devices, provide these details to the node maintainer to help locate the certificate deployment issue.
Step 4: Check TLS parameters in the client
After confirming that the external certificate is valid, inspect the node parameters saved in the client. The v2rayN desktop client usually runs the Xray core; v2rayNG uses the Xray core; v2flyNG uses the V2Fly core. Log wording varies between cores, but the five checks remain in the same order: address, port, transport security, SNI, and system time.
-
Pin a single node
Turn off automatic selection and choose one node that reproduces the error consistently. Record its label, address, port, transport, and TLS serverName first so rotation between nodes does not confuse the diagnosis.
-
Check the core type
In v2rayN, open Settings → Parameter settings → Core type and confirm that the current protocol uses the expected core. Save, then select Servers → Restart service.
-
Edit the server
In the v2rayN server list, select the node and open the editor. Check the address, port, transport protocol, transport-layer security, and SNI one by one. Do not copy the node label into serverName.
-
Check the Android configuration
In v2rayNG or v2flyNG, open the target node's edit page from the configuration list and check Address, Port, Transport security, and SNI. Save, select the node again, and start the connection.
-
Update the subscription and retest
If a manually added node works but a subscription node fails, update the subscription and compare the TLS fields. When several subscription groups are present, confirm that the current node belongs to the group you just updated.
-
Read the first error
Clear or separate the logs, connect only once, and read the first certificate or handshake error. Then return to the corresponding troubleshooting branch using the error keywords.
| Symptom | Check first | How to tell |
|---|---|---|
| All TLS nodes fail at once | System time, system certificate store, current network | Similar certificate errors appear across different subscriptions and hostnames |
| Every node on the same entry point fails | Certificate expiration, certificate chain, entry-point port | Multiple node addresses or SNI values point to the same service entry point |
| Only one node fails | serverName, address, port, subscription fields | Other TLS nodes work on the same device and network |
| Failures begin after a subscription update | Differences between the old and new configuration fields | An older node kept manually still connects |
Step 5: Separate certificate, network, and protocol issues
Some logs contain handshake failed even when the root cause is not the certificate. A target port without TLS, a connection reset in transit, or an entry point that is not listening can all end the handshake early. Look for x509, certificate, hostname, expired, or unknown authority in the error. If present, follow the certificate path first; otherwise check network reachability and server listening status.
Change one variable at a time: synchronize the clock and retest, then change SNI and retest, inspect the certificate chain, and only then update the core or rebuild the node. If you change networks, switch cores, edit the port, and reimport the subscription together, a recovered connection will not reveal what actually fixed it.
The latency test times out, but there is no certificate error in the log?
First check whether the node address resolves, whether the target port is reachable, and whether the local proxy port is already in use. Enter certificate troubleshooting only when the log contains certificate, x509, or TLS verification messages.
Why does the node handshake fail when the hostname opens in a browser?
The hostname opened in the browser, the entry address, and the node SNI may be different. Run a test with -servername using the node's actual settings and check the client's serverName instead of checking only whether the homepage opens.
Only some nodes fail after a subscription update?
Choose one working node and one failing node, then compare the address, port 443, TLS setting, and SNI. Partial failures usually point to a single entry-point certificate or subscription field, not a shared local setting.
The system time is correct, but the certificate is still reported as not yet valid?
Confirm the year, date, time zone, and automatic time-sync status, then check Not Before on the certificate. If multiple devices with correct clocks show the same result, the server usually needs to deploy a currently valid certificate again.
What if a hostname mismatch appears after changing the address to an IP?
The address can be an IP, but SNI should still contain the hostname covered by the certificate. If the subscription does not provide serverName, do not guess from the node label; obtain the complete configuration parameters again.
Final retest checklist
After correcting the configuration, perform one complete, reproducible test instead of checking only whether the client says Connected. Restart the core, run a node latency test, make an actual web or application request, and check the logs for new TLS errors. If the connection succeeds but webpages do not load, the issue is beyond TLS; check the system proxy, DNS, routing rules, and outbound configuration.
- The system date, time, and time zone are correct, and automatic synchronization has been run.
- The node address contains no spaces or outdated hostname, and the port matches the server entry point.
- Transport-layer security is enabled according to the subscription, with the TLS entry point using the specified port.
serverNamematches the hostname covered by the certificate; it is not the node label or an IP address.- WebSocket Host and TLS SNI were checked separately; the two fields were not treated as the same setting.
- The certificate is within its validity period, and the server sends the required intermediate certificates.
- After updating the subscription, confirm that the current node is the new one rather than a same-named configuration in an older group.
- The first certificate error has disappeared from the log, and three consecutive connection tests produce the same result.
Following this order turns a vague handshake failed message into a verifiable diagnosis: an incorrect clock affects validity checks, wrong SNI returns a mismatched certificate, an incomplete chain breaks trust validation, and a wrong port or entry point may disconnect before the handshake completes. Recording each change and retest is more effective than repeatedly deleting the client or bulk-editing node parameters.