{"id":"3cae17036939d70d","repo":"jackc/pgx","slug":"failed-to-split-host-port-in-s-err-w","errorCode":null,"errorMessage":"failed to split host:port in '%s', err: %w","messagePattern":"failed to split host:port in '(.+?)', err: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/config.go","lineNumber":683,"sourceCode":"\t\tif password, present := parsedURL.User.Password(); present {\n\t\t\tsettings[\"password\"] = password\n\t\t}\n\t}\n\n\t// Handle multiple host:port's in url.Host by splitting them into host,host,host and port,port,port.\n\tvar hosts []string\n\tvar ports []string\n\tfor host := range strings.SplitSeq(parsedURL.Host, \",\") {\n\t\tif host == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif isIPOnly(host) {\n\t\t\thosts = append(hosts, strings.Trim(host, \"[]\"))\n\t\t\tcontinue\n\t\t}\n\t\th, p, err := net.SplitHostPort(host)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to split host:port in '%s', err: %w\", host, err)\n\t\t}\n\t\tif h != \"\" {\n\t\t\thosts = append(hosts, h)\n\t\t}\n\t\tif p != \"\" {\n\t\t\tports = append(ports, p)\n\t\t}\n\t}\n\tif len(hosts) > 0 {\n\t\tsettings[\"host\"] = strings.Join(hosts, \",\")\n\t}\n\tif len(ports) > 0 {\n\t\tsettings[\"port\"] = strings.Join(ports, \",\")\n\t}\n\n\tdatabase := strings.TrimLeft(parsedURL.Path, \"/\")\n\tif database != \"\" {\n\t\tsettings[\"database\"] = database","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/config.go#L665-L701","documentation":"Error \"failed to split host:port in '%s', err: %w\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/config.go:683 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}