{"record":{"id":"7ec3fcecca49c211","repo":"t8y2/dbx","slug":"invalid-hive-port-w","errorCode":null,"errorMessage":"invalid Hive port: %w","messagePattern":"invalid Hive port: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/config.go","lineNumber":316,"sourceCode":"\t\treturn newParsedHiveConnection(), nil\n\t}\n\tif strings.HasPrefix(strings.ToLower(value), \"jdbc:hive2://\") {\n\t\tvalue = value[len(\"jdbc:hive2://\"):]\n\t} else if strings.HasPrefix(strings.ToLower(value), \"hive://\") {\n\t\tparsedURL, err := url.Parse(value)\n\t\tif err != nil {\n\t\t\treturn parsedHiveConnection{}, fmt.Errorf(\"invalid Hive connection string: %w\", err)\n\t\t}\n\t\tresult := newParsedHiveConnection()\n\t\tif parsedURL.User != nil {\n\t\t\tresult.username = parsedURL.User.Username()\n\t\t\tresult.password, _ = parsedURL.User.Password()\n\t\t}\n\t\tport := defaultHivePort\n\t\tif parsedURL.Port() != \"\" {\n\t\t\tparsedPort, err := strconv.Atoi(parsedURL.Port())\n\t\t\tif err != nil {\n\t\t\t\treturn parsedHiveConnection{}, fmt.Errorf(\"invalid Hive port: %w\", err)\n\t\t\t}\n\t\t\tport = parsedPort\n\t\t}\n\t\tresult.endpoints = []endpoint{{Host: parsedURL.Hostname(), Port: port}}\n\t\tresult.database = strings.Trim(parsedURL.Path, \"/\")\n\t\tfor key, entries := range parsedURL.Query() {\n\t\t\tif len(entries) > 0 {\n\t\t\t\tsetCaseInsensitive(result.parameters, key, entries[len(entries)-1])\n\t\t\t}\n\t\t}\n\t\treturn result, nil\n\t} else {\n\t\treturn parsedHiveConnection{}, errors.New(\"Hive connection string must start with jdbc:hive2:// or hive://\")\n\t}\n\n\tresult := newParsedHiveConnection()\n\tif fragment := strings.IndexByte(value, '#'); fragment >= 0 {\n\t\tresult.hiveVars = parseHiveAssignments(value[fragment+1:], false)","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/config.go#L298-L334","documentation":"When parsing a hive:// URL that contains an explicit port, the driver converts the port substring with strconv.Atoi; a non-numeric port wraps that error. This guarantees endpoints only ever get valid integer ports.","triggerScenarios":"A hive:// URL whose port portion (parsedURL.Port()) is non-numeric, e.g. hive://host:abc/default or a path segment misinterpreted as a port after a malformed ':' delimiter.","commonSituations":"Typos in the port, pasting 'host:10000/default' with a stray colon, or IPv6 hosts written without brackets so SplitHostPort/Port() misparse the segments.","solutions":["Correct the port in the URL to a plain integer, e.g. hive://host:10000/default","Bracket IPv6 hosts: hive://[::1]:10000/default","Omit the port entirely to use defaultHivePort","Pre-validate with strconv.Atoi or url.Parse in your own config loader"],"exampleFix":"// before\nurl := \"hive://myhost:10o000/default\"\n// after\nurl := \"hive://myhost:10000/default\"","handlingStrategy":"validation","validationCode":"if u, err := url.Parse(connStr); err == nil && u.Port() != \"\" {\n    if p, err := strconv.Atoi(u.Port()); err != nil || p < 1 || p > 65535 {\n        return fmt.Errorf(\"port %q in %q must be 1-65535\", u.Port(), connStr)\n    }\n}","typeGuard":"func validPort(s string) bool {\n    p, err := strconv.Atoi(s)\n    return err == nil && p >= 1 && p <= 65535\n}","tryCatchPattern":"conn, err := parseHiveConnection(raw)\nif err != nil && strings.Contains(err.Error(), \"invalid Hive port\") {\n    return fmt.Errorf(\"check hive URL port syntax: %w\", err)\n}","preventionTips":["Always bracket IPv6 hosts in URLs","Omit the port to use the default instead of hand-typing it","Lint config templates for unresolved placeholders like ${PORT}","Render the final URL and url.Parse it in CI"],"tags":["hive","config","port","url-parsing"],"backgroundTag":"invalid-port","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}