What should I do if client traffic and their online status are not displayed in the 3x-ui panel?
An error was found in the logs:
DEBUG - Failed to fetch Xray traffic:rpc error: code = Unavailable desc = connection error: desc = "error reading server preface: EOF"
The ports seem to be working and don’t conflict, but I’m not a specialist. The latest versions of xray and 3x-ui are installed on the VPS server. How can I solve this problem?
The error “error reading server preface: EOF” typically indicates a communication breakdown between the 3x-ui panel and the Xray core, preventing traffic data collection. This is often caused by configuration mismatches, version conflicts, or communication protocol issues between the components.
Contents
- Main Causes of the Problem
- Step-by-Step Solution
- Checking Xray Configuration
- Resolving Version Conflicts
- Additional Troubleshooting Methods
- Preventative Measures
Main Causes of the Problem
Based on research of GitHub issues, the main causes of the “Failed to fetch Xray traffic” error with EOF error include:
- Component version mismatch - between 3x-ui and xray-core
- Configuration issues - especially with logging and statistics settings
- Configuration format errors - JSON syntax errors
- Port or process conflicts - overlapping ports or zombie processes
- Permission issues - insufficient rights to read configuration
As noted in issue #1684, this error occurs due to problems with querying statistics from xray-core: QueryStats only works its own stats.Manager.
Step-by-Step Solution
1. Restart services
systemctl restart x-ui systemctl restart xray
2. Check service status
systemctl status x-ui systemctl status xray
3. Check logs for errors
journalctl -u x-ui -f journalctl -u xray -f
Important: If the error persists after restarting, proceed to the next diagnostic steps.
Checking Xray Configuration
1. Check configuration file
/usr/local/x-ui/x-ui xray check
2. Validate JSON format
cat /usr/local/x-ui/bin/config.json | python3 -m json.tool
3. Configure traffic logging
According to the official documentation, add the access log path in the settings:
- Go to “Xray Configs”
- Set the log path:
./access.log - Save and restart xray
4. Check inbound/outbound configuration
Ensure all configurations are correct and contain no syntax errors, especially in protocol settings (VLESS, Vmess, Trojan, etc.).
Resolving Version Conflicts
1. Check version compatibility
Check compatibility between 3x-ui and xray-core versions on the official GitHub.
2. Update components
# Update 3x-ui
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
# Check xray version
/usr/local/x-ui/x-ui version
3. Manually install compatible xray version
If automatic update doesn’t solve the problem, manually install a compatible version.
4. Complete reinstallation
In extreme cases, perform a complete reinstallation:
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh) --remove
Additional Troubleshooting Methods
1. Clear cache and temporary files
rm -rf /tmp/x-ui-*
rm -rf /var/log/x-ui/*
2. Check permissions
chown -R nobody:nogroup /usr/local/x-ui/
chmod -R 755 /usr/local/x-ui/
3. Check for conflicting processes
lsof -i :port_number ps aux | grep xray
4. Test configuration manually
/usr/local/x-ui/xray run -test -confdir /usr/local/x-ui/bin/
Preventative Measures
1. Regular configuration backup
cp /usr/local/x-ui/bin/config.json /usr/local/x-ui/bin/config.json.bak
2. Monitor service status
Set up monitoring using cron:
*/5 * * * * /usr/local/x-ui/x-ui check > /dev/null 2>&1
3. Timely updates
Regularly check for and install updates.
4. Use stable versions
Avoid using beta versions in production environments.
Sources
- GitHub Issue #1684 - get xray traffic failed rpc error
- GitHub Issue #1784 - Panel won’t restart xray
- GitHub Issue #3178 - xray state: Not Running
- GitHub Issue #3301 - xray state: Not running
- GitHub Configuration Wiki
- GitHub Common questions and problems
- XTLS/Xray-core Discussion #4124 - EOF error with CDN
Conclusion
- The main problem is a communication failure between 3x-ui and xray-core, which prevents traffic statistics collection.
- The most effective solution is checking and updating components, validating configuration, and resolving version conflicts.
- To prevent problems in the future, it’s recommended to regularly back up configurations and use only compatible component versions.
- If the problem persists after all measures taken, it’s worth contacting the 3x-ui developer community on GitHub for more specialized help.
Note that this problem often occurs when updating components, so always check version compatibility before installing updates.