context deadline exceeded, i/o timeout, EOF: what VPN client errors mean

The error context deadline exceeded means one step of the connection didn't finish in time: the client waited for the server and gave up. It is not a cause by itself, only a sign that the server didn't answer, or answered and was cut off. The real cause is in the words next to it (i/o timeout, connection reset by peer, EOF, tls: handshake failure), and each of them points to its own fix.

Updated

On this page

What context deadline exceeded means

Xray, sing-box and v2ray are written in Go, and this is how Go reports a timeout: an operation had a time limit (connecting to the server, the TLS handshake, a test request) and the limit ran out. v2rayN and v2rayNG show it in a delay test or in the log; clients built on sing-box, such as Hiddify and NekoBox, in their logs.

So the phrase alone says just one thing: the server didn't answer in time. Why, the rest of the line tells you. Xray writes long chains joined by >, from the general to the specific, for example failed to process outbound traffic, failed to find an available destination, failed to dial. Read to the end: the last part, such as dial tcp 203.0.113.5:443: i/o timeout, is the cause.

Each error in plain words

  • i/o timeout — the client asked to connect and nothing came back. The server is off, the address or port is wrong, a firewall drops the packets, or the network doesn't let them through.
  • connection refused — the server answered, but nothing listens on that port: the VPN service isn't running, or the port in the link is wrong.
  • connection reset by peer — the connection opened and was then torn down (on Windows: An existing connection was forcibly closed by the remote host). The server didn't accept the settings, or equipment on the way recognized the protocol.
  • EOF — the other side closed the connection without a word. Most often the server didn't recognize the client: a wrong UUID or password, a different flow, transport or path.
  • tls: handshake failure — the secure handshake didn't agree: the server has no certificate for the link's sni, or the link asks for TLS where the server has none.
  • x509: certificate has expired or is not yet valid — the certificate looks out of date. Usually it isn't: the device's clock is wrong.
  • timeout: no recent network activity — the QUIC error of Hysteria2 and TUIC: UDP packets stopped coming back.
  • no such host — the server's name doesn't turn into an address: a typo, a domain that no longer exists, or DNS that doesn't answer.

What you see, why, and what to do

  • context deadline exceeded on its own, the delay test fails

    CauseThe server didn't answer in time; the cause is in the lines around it

    What to doRead the full log; check the port with the commands below

  • i/o timeout

    CauseThe server is off, the address or port is wrong, or the packets are dropped on the way

    What to doCheck the port; if it doesn't open, try another network, mobile data for example

  • connection refused

    CauseThe server is reachable, but nothing listens on the port

    What to doStart the VPN service on the server; compare the port in the link with its settings

  • connection reset by peer, forcibly closed by the remote host

    CauseThe server rejects the settings, or the network breaks the connection

    What to doCompare the link with the server; if it's right, move to a disguised protocol such as VLESS Reality

  • EOF

    CauseThe server didn't recognize the client: UUID, password, flow, transport or path

    What to doGet a fresh link; read the server's log

  • tls: handshake failure

    CauseTLS doesn't match: the sni, the security setting or the port

    What to doCheck security, sni and the port in the link; for Reality, turn TLS fragmentation off

  • x509: certificate has expired or is not yet valid, or VMess fails quietly

    CauseThe device's clock is wrong

    What to doTurn on automatic date and time, then reconnect

  • timeout: no recent network activity on Hysteria2 or TUIC

    CauseUDP doesn't pass on this network, or the server's UDP port is closed

    What to doOpen the UDP port on the server, or use a protocol over TCP

Check that the server's port opens

Take the address and port from the link: in vless://id@203.0.113.5:443?... they are 203.0.113.5 and 443. Run the check with the VPN off. These commands test TCP (VLESS, VMess, Trojan, Shadowsocks); a UDP port (WireGuard, Hysteria2, TUIC) can't be checked this way.

Windows: PowerShell
Test-NetConnection 203.0.113.5 -Port 443

Look at TcpTestSucceeded: True — the port opens from here, False — it doesn't. A server name instead of the address works too.

macOS and Linux: Terminal
nc -vz -w 5 203.0.113.5 443

succeeded — the port opens. Connection refused — the server is there, but nothing listens on the port. No answer within 5 seconds — the packets don't reach it.

Windows, macOS and Linux
nslookup vpn.example.com

For a server given by name: an address in the answer means the name works, can't find means it doesn't resolve.

  • The port opens, but the client still fails — the server is alive; the protocol's settings are wrong or the network recognizes the protocol.
  • It opens from another network only (mobile data, a friend's Wi-Fi) — your network doesn't let it through. Change the protocol.
  • It opens from nowhere — the server: the service stopped, the firewall is closed or the server is down. If it is yours, journalctl -u xray -n 50 --no-pager shows what it made of the connection.

Check the clock

A certificate is valid between two dates, and with a clock that is days off, the client decides it has expired. VMess is stricter: the client's and the server's time may differ by no more than 90 seconds, or the server quietly drops the connection. What counts is the real time, so a clock set by hand to the right hours in the wrong time zone is wrong too.

On Android: Settings → System → Date & time → Set time automatically (the path differs a little from phone to phone).

Windows: PowerShell or cmd
w32tm /stripchart /computer:time.windows.com /samples:3 /dataonly

Each line shows the offset from an exact clock, such as +00.0352412s. Seconds are fine, minutes or hours are the problem. Fix it in Settings → Time & language → Date & time → Set time automatically.

macOS: Terminal
sntp time.apple.com

The first number is the offset in seconds. Fix it in System Settings → General → Date & Time.

Linux: Terminal
timedatectl

System clock synchronized: yes — the time is synced. no — turn syncing on with sudo timedatectl set-ntp true.

In Veli

Veli names the cause in words

Veli shows the same causes in plain words rather than Go errors. While it connects, the line under the button says what is wrong: “The server isn't answering: it's down, or the network doesn't let it through”, “The server refuses the connection: the VPN isn't running on it, or the port is closed”, “The server takes the connection, but the link to it gets cut: the network seems to be in the way”, or that the server's name can't be found. If the server never answers, the app stops after about a minute and a half and says why; “What happened” opens the connection's record in the log. On Android the reason is in the notification too.

On a computer, Profiles checks each server through its own protocol, not just by ping: a working one shows its time, a broken one a word such as “no answer”, “blocked” or “no address”, with the reason in a tooltip (“port closed”, “connection cut”). Diagnostics → “Check everything” also checks the system clock: if it is off, the line says TLS protocols (Reality, VLESS) won't connect with that time, and “Sync the clock” sets it.

FAQ

What does context deadline exceeded mean in v2rayNG?

The test or the connection waited for the server longer than its limit and gave up: the server didn't answer. Check that its port opens, the device's clock and whether another network works.

Is context deadline exceeded a problem with my phone or with the server?

Most often with the server or the way to it. On the device's side it is usually the clock or a link cut off when copied.

What is the difference between i/o timeout and connection refused?

With i/o timeout nothing answered at all: the server is down or the packets are dropped on the way. With connection refused the server answered, but nothing listens on that port.

Why do I get EOF with a link that worked yesterday?

The server changed something: a key, a UUID or a port, or your user was removed. Ask for a fresh link. If a fresh one still fails on just one network, that network breaks the protocol.

Veli says why it won't connect

The line under the button names the cause in plain words, and on a computer Profiles checks every server through its own protocol, not just by ping.