{"record":{"id":"07d6903c22a69313","repo":"ginuerzh/gost","slug":"status-d","errorCode":null,"errorMessage":"status %d","messagePattern":"status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"relay.go","lineNumber":289,"sourceCode":"\theaderSent bool\n}\n\nfunc (c *relayConn) Read(b []byte) (n int, err error) {\n\tc.once.Do(func() {\n\t\tif c.isServer {\n\t\t\treturn\n\t\t}\n\t\tresp := new(relay.Response)\n\t\t_, err = resp.ReadFrom(c.Conn)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif resp.Version != relay.Version1 {\n\t\t\terr = relay.ErrBadVersion\n\t\t\treturn\n\t\t}\n\t\tif resp.Status != relay.StatusOK {\n\t\t\terr = fmt.Errorf(\"status %d\", resp.Status)\n\t\t\treturn\n\t\t}\n\t})\n\n\tif err != nil {\n\t\tlog.Logf(\"[relay] %s <- %s: %s\", c.Conn.LocalAddr(), c.Conn.RemoteAddr(), err)\n\t\treturn\n\t}\n\n\tif !c.udp {\n\t\treturn c.Conn.Read(b)\n\t}\n\tvar bb [2]byte\n\t_, err = io.ReadFull(c.Conn, bb[:])\n\tif err != nil {\n\t\treturn\n\t}\n\tdlen := int(binary.BigEndian.Uint16(bb[:]))","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/relay.go#L271-L307","documentation":"In the gost relay client path, relayConn.Read (relay.go:288) reads the server's relay response header once and, if the returned status is not relay.StatusOK (0), surfaces \"status %d\" with the numeric status code. It means the relay server accepted the connection but rejected the tunnel request instead of establishing the data channel.","triggerScenarios":"Connecting through a gost relay node whose server replies with a non-zero relay response status — e.g. authentication rejected by the remote relay, the remote node refusing the forward request, or a mismatch where the peer answers with an error status.","commonSituations":"Chained gost proxies where the upstream relay requires different credentials, the upstream address is served by a non-relay service, or relay protocol incompatibilities (the sibling ErrBadVersion check is at relay.go:284).","solutions":["Check the numeric status in the message against the relay protocol status codes to identify the exact rejection (e.g. unauthorized vs forbidden)","Verify relay node credentials (user/password) in the gost config match the upstream relay server's auth config","Confirm the upstream address is actually a gost relay endpoint speaking relay protocol Version1, not an HTTP/SOCKS server","Inspect the remote relay server logs for the corresponding rejection reason and update the local node config accordingly"],"exampleFix":"// before\nnodes = relay://user:wrongpass@relay.example.com:8421\n// after\nnodes = relay://user:correctpass@relay.example.com:8421","handlingStrategy":"try-catch","validationCode":"// before dialing, verify the relay node has credentials that match the server\nif node.Auth == nil {\n    return errors.New(\"relay node requires auth credentials matching the server\")\n}","typeGuard":"func isRelayStatusError(err error) bool {\n    return err != nil && strings.HasPrefix(err.Error(), \"status \")\n}","tryCatchPattern":"conn, err := client.Dial(addr)\nif err != nil {\n    if isRelayStatusError(err) {\n        code := strings.TrimPrefix(err.Error(), \"status \")\n        log.Printf(\"relay server rejected request with status %s; check auth/config\", code)\n        return err // server-side rejection, not transient — don't retry blindly\n    }\n    return retry(err)\n}","preventionTips":["Match relay node user/password exactly with the upstream relay server's auth config","Ensure the upstream address is a gost relay (Version1) endpoint, not HTTP/SOCKS","Keep gost versions compatible on both ends to avoid status/version rejections","Log the numeric status code from the error message and map it to the relay protocol status table"],"tags":["relay","protocol","proxy","gost"],"backgroundTag":"relay-request-rejected","analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}