{"record":{"id":"befb55b3523d1aef","repo":"fatedier/frp","slug":"failed-to-parse-proxy-s-err-v","errorCode":null,"errorMessage":"failed to parse proxy %s, err: %v","messagePattern":"failed to parse proxy (.+?), err: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/legacy/client.go","lineNumber":273,"sourceCode":"\t\tif name == ini.DefaultSection || name == \"common\" || strings.HasPrefix(name, \"range:\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t_, shouldStart := startProxy[name]\n\t\tif !startAll && !shouldStart {\n\t\t\tcontinue\n\t\t}\n\n\t\troleType := section.Key(\"role\").String()\n\t\tif roleType == \"\" {\n\t\t\troleType = \"server\"\n\t\t}\n\n\t\tswitch roleType {\n\t\tcase \"server\":\n\t\t\tnewConf, newErr := NewProxyConfFromIni(prefix, name, section)\n\t\t\tif newErr != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to parse proxy %s, err: %v\", name, newErr)\n\t\t\t}\n\t\t\tproxyConfs[prefix+name] = newConf\n\t\tcase \"visitor\":\n\t\t\tnewConf, newErr := NewVisitorConfFromIni(prefix, name, section)\n\t\t\tif newErr != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to parse visitor %s, err: %v\", name, newErr)\n\t\t\t}\n\t\t\tvisitorConfs[prefix+name] = newConf\n\t\tdefault:\n\t\t\treturn nil, nil, fmt.Errorf(\"proxy %s role should be 'server' or 'visitor'\", name)\n\t\t}\n\t}\n\treturn proxyConfs, visitorConfs, nil\n}\n\nfunc renderRangeProxyTemplates(f *ini.File, section *ini.Section) error {\n\t// Validation\n\tlocalPortStr := section.Key(\"local_port\").String()","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/config/legacy/client.go#L255-L291","documentation":"Legacy ini loader: for a non-range proxy section (role defaults to 'server' when the role key is absent), NewProxyConfFromIni validates and maps the section onto the typed proxy config. Any validation failure — unknown proxy type, invalid port values, missing required fields, bad transport/plugin options — is wrapped here with the section name.","triggerScenarios":"A [proxy] section with type = 'tcp' but a non-numeric or out-of-range local_port/remote_port; type not in {tcp,udp,xtcp,stcp,sudp,http,https,tcpmux}; plugin.* keys with invalid values; negative or >65535 ports.","commonSituations":"Hand-editing ini configs and introducing typos ('loca_port'), switching type without updating type-specific keys, using remote_port=0 with a type that requires it (e.g. stcp visitor semantics), leftover keys from a different proxy type.","solutions":["Check the inner error text — NewProxyConfFromIni names the failing field or value","Confirm type is one of tcp/udp/xtcp/stcp/sudp/https/http/tcpmux and the section's keys apply to that type","Fix numeric fields: ports must be integers 0-65535 (0 only where random is allowed)","Migrate the file to TOML and run frpc verify (frpc verify -c frpc.toml) to catch these before runtime"],"exampleFix":"; before\n[ssh]\ntype = tcp\nlocal_port = 22\nremote_port = 7ooo   ; letter 'o' instead of zero\n\n; after\n[ssh]\ntype = tcp\nlocal_port = 22\nremote_port = 7000","handlingStrategy":"validation","validationCode":"validTypes := map[string]bool{\"tcp\":true,\"udp\":true,\"xtcp\":true,\"stcp\":true,\"sudp\":true,\"http\":true,\"https\":true,\"tcpmux\":true}\nif !validTypes[section.Key(\"type\").String()] {\n    return fmt.Errorf(\"proxy %s: invalid type\", section.Name())\n}\nif p, err := section.Key(\"local_port\").Int(); err != nil || p < 0 || p > 65535 {\n    return fmt.Errorf(\"proxy %s: bad local_port\", section.Name())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep proxy sections minimal and type-appropriate; delete leftover keys when changing type","Validate ports as 0-65535 integers before deploy","Prefer TOML configs and frpc verify for early feedback"],"tags":["frp","config","ini","proxy","validation"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}