The Xray service won't start (failed or restarting)
VLESS + Reality troubleshooting
Updated
What you see
systemctl status xray shows failed, or keeps flipping between activating and failed, and no client can connect.
What it means
Xray reads its whole configuration at startup and quits at the first thing it can't accept. The reason is always written to the log, and Xray can also check a config without starting.
Quick fix
Read the last lines of the log with sudo journalctl -u xray -n 50 --no-pager. The error names what's wrong; the causes below cover the usual ones.
Causes and how to fix them
1. A mistake in the JSON file
A missing comma, an extra trailing comma or an unclosed bracket stops Xray before anything else. Have Xray check the file and point at the problem (the path depends on how Xray was installed; the official script uses this one):
sudo xray run -test -config /usr/local/etc/xray/config.json
2. The port is already taken
If the log says “address already in use”, another program holds Xray's port. That has its own page: see the related fix below.
3. A Reality key isn't valid
The privateKey in a Reality config must be a key generated for it, not an arbitrary string. Make a pair, put the private key on the server and the public key in your clients:
xray x25519
4. A routing rule names something that doesn't exist
Rules such as geoip:ru or geosite:category-ads read from the data files geoip.dat and geosite.dat. A country code that isn't in the file, or a missing file, stops Xray from starting. Remove the rule, or update the data files.
5. The Xray version is too old for the config
A setting that needs a newer Xray, like the XHTTP transport (24.9 or later), is rejected as unknown by an old version. Check what's installed and update it:
xray version
Using Nullsify?
Nullsify writes the Xray configuration for you, so a hand-edited file is the usual culprit on one of its servers — undo your change rather than patching the file further. If the log blames a port, change it in the advanced VLESS settings.
Free for 1 server. Bring your own VPS — Nullsify configures WireGuard, AmneziaWG or VLESS on it for you.
Related problems
- “bind: address already in use” VLESS + Reality
- Connected but websites don't load VLESS + Reality
- “REALITY: processed invalid connection” VLESS + Reality