{"record":{"id":"a2a672858efaba87","repo":"t8y2/dbx","slug":"invalid-hive-endpoint-q-w","errorCode":null,"errorMessage":"invalid Hive endpoint %q: %w","messagePattern":"invalid Hive endpoint %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/config.go","lineNumber":396,"sourceCode":"\t\tif trimmed := strings.TrimSpace(part); trimmed != \"\" {\n\t\t\tresult = append(result, trimmed)\n\t\t}\n\t}\n\treturn result\n}\n\nfunc parseEndpoint(value string, defaultPort int) (endpoint, error) {\n\tvalue = strings.TrimSpace(value)\n\tif value == \"\" {\n\t\treturn endpoint{}, errors.New(\"Hive endpoint is empty\")\n\t}\n\thost := value\n\tport := defaultPort\n\tif parsedHost, parsedPort, err := net.SplitHostPort(value); err == nil {\n\t\thost = parsedHost\n\t\tparsed, parseErr := strconv.Atoi(parsedPort)\n\t\tif parseErr != nil {\n\t\t\treturn endpoint{}, fmt.Errorf(\"invalid Hive endpoint %q: %w\", value, parseErr)\n\t\t}\n\t\tport = parsed\n\t} else if strings.Count(value, \":\") == 1 {\n\t\tparts := strings.SplitN(value, \":\", 2)\n\t\tparsed, parseErr := strconv.Atoi(parts[1])\n\t\tif parseErr != nil {\n\t\t\treturn endpoint{}, fmt.Errorf(\"invalid Hive endpoint %q: %w\", value, parseErr)\n\t\t}\n\t\thost = parts[0]\n\t\tport = parsed\n\t} else if strings.HasPrefix(value, \"[\") && strings.HasSuffix(value, \"]\") {\n\t\thost = strings.Trim(value, \"[]\")\n\t}\n\tif strings.TrimSpace(host) == \"\" || port <= 0 || port > 65535 {\n\t\treturn endpoint{}, fmt.Errorf(\"invalid Hive endpoint %q\", value)\n\t}\n\treturn endpoint{Host: host, Port: port}, nil\n}","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/config.go#L378-L414","documentation":"parseHiveEndpoint first tries net.SplitHostPort; when that succeeds, the extracted port string must parse as an integer via strconv.Atoi, otherwise the endpoint is rejected with this wrapped error. It enforces host:port endpoints from comma-separated endpoint lists.","triggerScenarios":"An endpoint value like 'host:notaport' where SplitHostPort succeeds (one colon) but the port substring fails Atoi.","commonSituations":"Typos ('host:10o000'), placeholder ports from templates ('host:PORT' unsubstituted), or service names ('host:http') instead of numbers.","solutions":["Replace the port with a numeric value 1-65535","Fix unsubstituted template placeholders in the endpoint list","Remove a redundant trailing colon or use bare hostname to take the default port","Pre-validate endpoints with net.SplitHostPort plus strconv.Atoi before config load"],"exampleFix":"// before\nendpoints: \"host1:PORT1,host2:10000\"\n// after\nendpoints: \"host1:10000,host2:10000\"","handlingStrategy":"validation","validationCode":"for _, ep := range strings.Split(endpointsCSV, \",\") {\n    if _, _, err := net.SplitHostPort(ep); err == nil {\n        if _, perr := strconv.Atoi(strings.TrimPrefix(ep, ep[:strings.LastIndex(ep, \":\")+1])); perr != nil {\n            return fmt.Errorf(\"endpoint %q port must be numeric\", ep)\n        }\n    }\n}","typeGuard":"func validEndpoint(v string) bool {\n    h, p, err := net.SplitHostPort(v)\n    if err != nil { return false }\n    n, err := strconv.Atoi(p)\n    return strings.TrimSpace(h) != \"\" && err == nil && n > 0 && n <= 65535\n}","tryCatchPattern":"ep, err := parseHiveEndpoint(v)\nif err != nil && strings.Contains(err.Error(), \"invalid Hive endpoint\") {\n    return fmt.Errorf(\"endpoint %q rejected: %w\", v, err)\n}","preventionTips":["Use numeric ports, never service names or placeholders","Keep host:port format consistent across all comma-separated entries","Validate every list entry; one bad entry fails the whole config","Generate endpoints from structured data, not string concatenation"],"tags":["hive","config","endpoint","port"],"backgroundTag":"invalid-port","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}