fatedier/frp · error
send newVisitorConnMsg to server error: %v
Error message
send newVisitorConnMsg to server error: %v
What it means
Visitor failed to write the NewVisitorConn control message to the frps server over the visitor connection. The message carries the run ID, target proxy name, an auth signature derived from the secret key, and encryption/compression flags. A write error means the underlying TCP/TLS stream to the server is broken or was closed before/during the send.
Source
Thrown at client/visitor/visitor.go:184
visitorConn, err := v.helper.ConnectServer()
if err != nil {
return nil, fmt.Errorf("connect to server error: %v", err)
}
now := time.Now().Unix()
targetProxyName := naming.BuildTargetServerProxyName(v.clientCfg.User, cfg.ServerUser, cfg.ServerName)
newVisitorConnMsg := &msg.NewVisitorConn{
RunID: v.helper.RunID(),
ProxyName: targetProxyName,
SignKey: util.GetAuthKey(cfg.SecretKey, now),
Timestamp: now,
UseEncryption: cfg.Transport.UseEncryption,
UseCompression: cfg.Transport.UseCompression,
}
err = visitorConn.WriteMsg(newVisitorConnMsg)
if err != nil {
visitorConn.Close()
return nil, fmt.Errorf("send newVisitorConnMsg to server error: %v", err)
}
_ = visitorConn.SetReadDeadline(time.Now().Add(10 * time.Second))
var newVisitorConnRespMsg msg.NewVisitorConnResp
err = visitorConn.ReadMsgInto(&newVisitorConnRespMsg)
if err != nil {
visitorConn.Close()
return nil, fmt.Errorf("read newVisitorConnRespMsg error: %v", err)
}
_ = visitorConn.SetReadDeadline(time.Time{})
if newVisitorConnRespMsg.Error != "" {
visitorConn.Close()
return nil, fmt.Errorf("start new visitor connection error: %s", newVisitorConnRespMsg.Error)
}
return visitorConn, nil
}
View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Check frps is running and reachable: verify serverAddr/serverPort and that transport.tls settings match between frpc and frps.
- Inspect frps logs at the same timestamp; the server side usually logs why it dropped the visitor connection.
- Check network path stability between the visitor host and the server (firewall, NAT timeout, middlebox interference on the port).
- Confirm the visitor's secretKey matches the server; a bad signature is often rejected by closing the connection.
- frpc retries visitor connections automatically; persistent recurrence points to a systematic config problem rather than a one-off blip.
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight the server before enabling visitors
conn, err := net.DialTimeout("tcp",
fmt.Sprintf("%s:%d", cfg.ServerAddr, cfg.ServerPort), 5*time.Second)
if err != nil { /* surface friendly error, skip visitor start */ }
conn.Close() Try / catch
// Treat any error from the visitor dial as fatal for that attempt;
// the visitor manager already retries with backoff — log and return.
if _, err := v.newVisitorConn(ctx); err != nil {
xl.Warnf("visitor dial failed, will retry: %v", err)
} Prevention
- Keep frpc/frps versions matched
- Verify serverAddr/serverPort/TLS flags before deploying visitors
- Monitor frps health so visitors fail fast against a healthy server
When it happens
Trigger: visitorConn.WriteMsg(newVisitorConnMsg) returns non-nil: connection reset by the server, TLS handshake failure surfacing on first write, network drop between visitor and frps, or the server closing the connection immediately after accept.
Common situations: frps restarted or crashed while the frpc visitor was dialing; wrong serverPort/TLS settings so the peer is not actually frps; a firewall or NAT silently dropping the established flow; secret key mismatch causing the server to close early.
Related errors
- connect to server error: %v
- read newVisitorConnRespMsg error: %v
- loginRespMsg.Error
- ErrNoTunnelSession
- visitor plugin type is empty
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/c9d8e08e949dab73.
Report an issue: GitHub.