{"record":{"id":"dccf32a0cdf99849","repo":"t8y2/dbx","slug":"invalid-hive-endpoint-q-w-dccf32","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/hive-go/config.go","lineNumber":399,"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":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/config.go#L381-L417","documentation":"parseEndpoint accepts host:port (via net.SplitHostPort) or plain host forms. If a colon-containing value looks like host:port but the port substring fails strconv.Atoi, the driver rejects the endpoint with this wrapped error. Note SplitHostPort may succeed for IPv6 literals, so this branch fires when a port was explicitly parsed but is not numeric.","triggerScenarios":"Endpoint strings like 'hiveserver:notaport' where SplitHostPort succeeds (host='hiveserver', port='notaport') and strconv.Atoi fails; also IPv6 literals like '[::1]:xyz' with non-numeric ports.","commonSituations":"Environment-variable endpoints with placeholders (HOST:PORT left literal); secrets/config mixups where a password fragment landed in the port field; sloppy CSV endpoint lists.","solutions":["Fix the port to a decimal integer after the colon","Drop the :port suffix to use the default port for a plain host","Check the wrapped strconv error for the exact bad token","Validate endpoint strings in config before constructing the client"],"exampleFix":"// before\nendpoints := []string{\"hs2.internal:PORT\"}\n// after\nendpoints := []string{\"hs2.internal:10000\"}","handlingStrategy":"validation","validationCode":"func validEndpoint(s string) bool {\n    if h, p, err := net.SplitHostPort(s); err == nil {\n        n, err := strconv.Atoi(p)\n        return h != \"\" && err == nil && n > 0 && n <= 65535\n    }\n    if i := strings.LastIndex(s, \":\"); i >= 0 {\n        n, err := strconv.Atoi(s[i+1:])\n        return s[:i] != \"\" && err == nil && n > 0 && n <= 65535\n    }\n    return strings.TrimSpace(s) != \"\"\n}","typeGuard":null,"tryCatchPattern":"ep, err := parseEndpoint(value)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid Hive endpoint\") {\n        return fmt.Errorf(\"endpoint must be host or host:port: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep endpoints as host or host:port with numeric ports","Reject placeholder values (HOST:PORT) in config validation","Trim scheme prefixes and trailing paths before parsing"],"tags":["hive","config","endpoint","port"],"backgroundTag":"invalid-endpoint","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"}