{"record":{"id":"d6a0000d01338ef7","repo":"fatedier/frp","slug":"remote-port-new-key-in-section-error-v","errorCode":null,"errorMessage":"remote_port new key in section error: %v","messagePattern":"remote_port new key in section error: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/config/legacy/client.go","lineNumber":331,"sourceCode":"\t}\n\n\t// Templates\n\tprefix := strings.TrimSpace(strings.TrimPrefix(section.Name(), \"range:\"))\n\n\tfor i := range localPorts {\n\t\ttmpname := fmt.Sprintf(\"%s_%d\", prefix, i)\n\n\t\ttmpsection, err := f.NewSection(tmpname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcopySection(section, tmpsection)\n\t\tif _, err := tmpsection.NewKey(\"local_port\", fmt.Sprintf(\"%d\", localPorts[i])); err != nil {\n\t\t\treturn fmt.Errorf(\"local_port new key in section error: %v\", err)\n\t\t}\n\t\tif _, err := tmpsection.NewKey(\"remote_port\", fmt.Sprintf(\"%d\", remotePorts[i])); err != nil {\n\t\t\treturn fmt.Errorf(\"remote_port new key in section error: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc copySection(source, target *ini.Section) {\n\tfor key, value := range source.KeysHash() {\n\t\t_, _ = target.NewKey(key, value)\n\t}\n}\n\n// GetDefaultClientConf returns a client configuration with default values.\n// Note: Some default values here will be set to empty and will be converted to them\n// new configuration through the 'Complete' function to set them as the default\n// values of the new configuration.\nfunc GetDefaultClientConf() ClientCommonConf {\n\treturn ClientCommonConf{","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/config/legacy/client.go#L313-L349","documentation":"Sibling of error 158: after successfully writing local_port into a derived range section, the same NewKey call is made for remote_port. Failure wraps here. Like error 158, go-ini only errors on frozen sections or invalid characters in the value, so with ordinary numeric port values produced by fmt.Sprintf('%d', ...) this path is effectively unreachable.","triggerScenarios":"Same class as error 158: programmatically frozen ini.File, control characters in the derived section state, or section-name collisions from a malformed range prefix.","commonSituations":"Essentially none for file-based configs; only exotic programmatic use of the legacy loader.","solutions":["Keep remote_port values as clean numeric ranges/lists","Avoid go-ini freeze options when feeding an ini.File to the legacy loader","If it recurs, dump the offending [range:...] section and report upstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !regexp.MustCompile(`^[0-9,\\- ]+$`).MatchString(remotePortStr) {\n    return fmt.Errorf(\"remote_port contains invalid characters: %q\", remotePortStr)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Same hygiene as local_port: digits, commas, dashes only","Validate both port strings before invoking the loader","Report repeated occurrences upstream with the raw section"],"tags":["frp","config","ini","range-proxy","go-ini"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}