{"record":{"id":"65abab449a2f0166","repo":"t8y2/dbx","slug":"hive-endpoint-is-empty-65abab","errorCode":null,"errorMessage":"Hive endpoint is empty","messagePattern":"Hive endpoint is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/config.go","lineNumber":391,"sourceCode":"\t}\n\treturn result, nil\n}\n\nfunc splitEndpoints(value string) []string {\n\tparts := strings.Split(value, \",\")\n\tresult := make([]string, 0, len(parts))\n\tfor _, part := range parts {\n\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","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/config.go#L373-L409","documentation":"parseEndpoint is given an empty (after trimming whitespace) endpoint string while building the endpoint list for a Hive connection. The parser refuses to create a zero-value endpoint so connections fail with a clear message instead of dialing an invalid address.","triggerScenarios":"A hosts/endpoints list containing an empty entry (e.g. 'host1,,host2' or a trailing comma 'host1,'), a hosts parameter set to only spaces, or splitting behavior that yields empty strings between separators.","commonSituations":"Environment variables like HIVE_HOSTS=\"\" or with stray commas, config files where users removed a host but left the delimiter, template-generated host lists with unfilled slots.","solutions":["Remove empty entries and stray commas from the hosts/endpoints list.","Set a real host for the entry, e.g. hive01.example.com:10000.","Trim the parameter source so whitespace-only values become empty and are dropped before parsing."],"exampleFix":"// before\nHIVE_HOSTS=\"hive01,,hive02\"\n// after\nHIVE_HOSTS=\"hive01:10000,hive02:10000\"","handlingStrategy":"validation","validationCode":"func sanitizeHosts(list string) []string {\n    var out []string\n    for _, h := range strings.Split(list, \",\") {\n        if h = strings.TrimSpace(h); h != \"\" {\n            out = append(out, h)\n        }\n    }\n    return out\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never build host lists with naive string concatenation","Trim and drop empty entries after splitting on commas","Validate every entry parses as host[:port] before connecting"],"tags":["hive","configuration","endpoint","parsing"],"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"}