{"record":{"id":"4e1196b7f186cbe1","repo":"AlistGo/alist","slug":"remote-port-is-required-for-tcp-proxy-type","errorCode":null,"errorMessage":"remote_port is required for tcp proxy type","messagePattern":"remote_port is required for tcp proxy type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/frp/frp.go","lineNumber":312,"sourceCode":"\t\t}\n\t\tproxyCfgs = append(proxyCfgs, p)\n\n\tcase \"https\":\n\t\tp := &v1.HTTPSProxyConfig{}\n\t\tp.Name = proxyName\n\t\tp.Type = \"https\"\n\t\tp.ProxyBackend = backend\n\t\tif customDomain != \"\" {\n\t\t\tp.CustomDomains = []string{customDomain}\n\t\t}\n\t\tif subdomain != \"\" {\n\t\t\tp.SubDomain = subdomain\n\t\t}\n\t\tproxyCfgs = append(proxyCfgs, p)\n\n\tcase \"tcp\":\n\t\tif remotePort <= 0 {\n\t\t\treturn nil, nil, fmt.Errorf(\"remote_port is required for tcp proxy type\")\n\t\t}\n\t\tp := &v1.TCPProxyConfig{}\n\t\tp.Name = proxyName\n\t\tp.Type = \"tcp\"\n\t\tp.ProxyBackend = backend\n\t\tp.RemotePort = remotePort\n\t\tproxyCfgs = append(proxyCfgs, p)\n\n\tcase \"stcp\":\n\t\tp := &v1.STCPProxyConfig{}\n\t\tp.Name = proxyName\n\t\tp.Type = \"stcp\"\n\t\tp.ProxyBackend = backend\n\t\tp.Secretkey = stcpSecretKey\n\t\tp.AllowUsers = []string{\"*\"}\n\t\tproxyCfgs = append(proxyCfgs, p)\n\n\tdefault:","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/frp/frp.go#L294-L330","documentation":"Returned by buildConfig when proxy type is 'tcp' but the remote port setting is 0 or negative. TCP proxies in frp expose a fixed port on the frps server, so remote_port is mandatory; other types (http/https/stcp) do not need it, which is why only this branch validates it.","triggerScenarios":"Setting conf.FRPProxyType to 'tcp' while FRPRemotePort is unset (defaults to 0) or set to a negative number, then starting the FRP client.","commonSituations":"Copying an http-type FRP config and switching the type to tcp without adding remote_port; remote_port field left at its zero default in the admin UI.","solutions":["Set a valid FRP remote port (1-65535, and one allowed by frps's allowPorts) in settings.","If you do not need a fixed exposed port, switch the proxy type to http/https/stcp instead.","Verify the port is not already taken on the frps server."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if strings.ToLower(proxyType) == \"tcp\" && remotePort <= 0 {\n    return fmt.Errorf(\"remote_port must be 1-65535 for tcp proxy\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate proxy-type-specific fields together: tcp requires remote_port in 1-65535.","Use a dropdown limited to http/https/tcp/stcp in settings UI.","Cross-check the chosen port against frps allowPorts configuration."],"tags":["frp","configuration","validation","port","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}