{"record":{"id":"30bff8c035de7672","repo":"fatedier/frp","slug":"group-should-have-same-remote-port","errorCode":null,"errorMessage":"group should have same remote port","messagePattern":"group should have same remote port","errorType":"exception","errorClass":"ErrGroupDifferentPort","httpStatus":null,"severity":"error","filePath":"server/group/group.go","lineNumber":25,"sourceCode":"//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage group\n\nimport (\n\t\"errors\"\n)\n\nvar (\n\tErrGroupAuthFailed    = errors.New(\"group auth failed\")\n\tErrGroupParamsInvalid = errors.New(\"group params invalid\")\n\tErrListenerClosed     = errors.New(\"group listener closed\")\n\tErrGroupDifferentPort = errors.New(\"group should have same remote port\")\n\tErrProxyRepeated      = errors.New(\"group proxy repeated\")\n\n\terrGroupStale = errors.New(\"stale group reference\")\n)\n","sourceCodeStart":7,"sourceCodeEnd":30,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/server/group/group.go#L7-L30","documentation":"ErrGroupDifferentPort is returned when a proxy joins an existing TCP group but requests a different remotePort (tcp.go:112). All members of a load-balance group share a single frps listener, so the port (like the address and group key) must match the port the first member registered.","triggerScenarios":"Two [[proxies]] with same group/groupKey but remotePort = 9000 on one and 9001 on the other; a member omitting remotePort so it defaults differently; port drift after config refactor.","commonSituations":"Scaling a service to more frpc instances and hand-editing ports per instance instead of keeping them equal; merging configs where one block was updated to a new port and others were not.","solutions":["Set the same remotePort on every proxy in the group — the shared listener serves all members","Pick the canonical port, apply it to all member configs, and frpc verify each one","If you actually want different ports, they are different groups: use different group names"],"exampleFix":"# before — member B has remotePort = 9001 while group uses 9000\n# after\n[[proxies]]\nname = \"b\"\ntype = \"tcp\"\ngroup = \"app\"\ngroupKey = \"correct-horse\"\nremotePort = 9000","handlingStrategy":"validation","validationCode":"// Config lint: all members of a group must share remotePort\nports := map[string]int{}\nfor _, p := range proxies {\n    if p.Group != \"\" {\n        if prev, ok := ports[p.Group]; ok && prev != p.RemotePort {\n            return fmt.Errorf(\"group %s: remotePort %d != %d\", p.Group, p.RemotePort, prev)\n        }\n        ports[p.Group] = p.RemotePort\n    }\n}","typeGuard":"func isGroupDifferentPort(err error) bool {\n    return errors.Is(err, group.ErrGroupDifferentPort)\n}","tryCatchPattern":"if errors.Is(err, group.ErrGroupDifferentPort) {\n    // set this member's remotePort to the group's existing port and reconnect\n}","preventionTips":["Fix remotePort once in a shared template variable for the whole group","Remember group members share one frps listener — different ports means different groups by design"],"tags":["frp","go","group","load-balance","port","server"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}