{"record":{"id":"573d3b09ceac2fd2","repo":"fatedier/frp","slug":"read-newvisitorconnrespmsg-error-v","errorCode":null,"errorMessage":"read newVisitorConnRespMsg error: %v","messagePattern":"read newVisitorConnRespMsg error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/visitor/visitor.go","lineNumber":192,"sourceCode":"\t\tRunID:          v.helper.RunID(),\n\t\tProxyName:      targetProxyName,\n\t\tSignKey:        util.GetAuthKey(cfg.SecretKey, now),\n\t\tTimestamp:      now,\n\t\tUseEncryption:  cfg.Transport.UseEncryption,\n\t\tUseCompression: cfg.Transport.UseCompression,\n\t}\n\terr = visitorConn.WriteMsg(newVisitorConnMsg)\n\tif err != nil {\n\t\tvisitorConn.Close()\n\t\treturn nil, fmt.Errorf(\"send newVisitorConnMsg to server error: %v\", err)\n\t}\n\n\t_ = visitorConn.SetReadDeadline(time.Now().Add(10 * time.Second))\n\tvar newVisitorConnRespMsg msg.NewVisitorConnResp\n\terr = visitorConn.ReadMsgInto(&newVisitorConnRespMsg)\n\tif err != nil {\n\t\tvisitorConn.Close()\n\t\treturn nil, fmt.Errorf(\"read newVisitorConnRespMsg error: %v\", err)\n\t}\n\t_ = visitorConn.SetReadDeadline(time.Time{})\n\n\tif newVisitorConnRespMsg.Error != \"\" {\n\t\tvisitorConn.Close()\n\t\treturn nil, fmt.Errorf(\"start new visitor connection error: %s\", newVisitorConnRespMsg.Error)\n\t}\n\treturn visitorConn, nil\n}\n\nfunc wrapVisitorConn(conn io.ReadWriteCloser, cfg *v1.VisitorBaseConfig) (io.ReadWriteCloser, func(), error) {\n\trwc := conn\n\tif cfg.Transport.UseEncryption {\n\t\tvar err error\n\t\trwc, err = libio.WithEncryption(rwc, []byte(cfg.SecretKey))\n\t\tif err != nil {\n\t\t\treturn nil, func() {}, fmt.Errorf(\"create encryption stream error: %v\", err)\n\t\t}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/client/visitor/visitor.go#L174-L210","documentation":"Visitor sent NewVisitorConn but failed to read the NewVisitorConnResp reply within the 10-second read deadline set just above this call (SetReadDeadline(now+10s)). The server never answered in time or the connection died while waiting, and the deadline converted that into an i/o timeout.","triggerScenarios":"visitorConn.ReadMsgInto(&newVisitorConnRespMsg) errors: server accepted the conn but stalled, server closed without replying, half-open connection after NAT reaping, or a malformed reply that fails message decoding.","commonSituations":"frps under heavy load or with a blocked event loop; middlebox dropping the return direction; server killed between accept and reply; TLS mismatch making the reply stream undecodable; frpc/frps protocol skew after upgrade so the server ignores the message.","solutions":["Check frps health and logs; a stalled server is the most common cause.","Verify matching frpc/frps versions; version skew can make the server ignore the visitor message.","Reproduce with packet capture (tcpdump on serverPort) to see whether a reply was sent at all.","Ensure keepalive/heartbeat settings detect dead paths early; the visitor manager retries automatically.","Confirm the address you connect to is frps, not another TLS service that will not reply."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := visitorConn.ReadMsgInto(&resp); err != nil {\n    visitorConn.Close()\n    if ne, ok := err.(net.Error); ok && ne.Timeout() {\n        // 10s deadline hit: server stalled or path broken; retry whole dial\n    }\n    return err\n}","preventionTips":["Watch frps event-loop latency; a stalled server is the root cause","Match frpc/frps versions to avoid protocol skew","Keep heartbeat intervals aggressive enough to detect dead paths early"],"tags":["network","timeout","visitor","frpc"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}