{"record":{"id":"ee9ab2ef37c4398f","repo":"t8y2/dbx","slug":"invalid-hive-connection-string-w","errorCode":null,"errorMessage":"invalid Hive connection string: %w","messagePattern":"invalid Hive connection string: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/config.go","lineNumber":305,"sourceCode":"func newParsedHiveConnection() parsedHiveConnection {\n\treturn parsedHiveConnection{\n\t\tparameters: map[string]string{},\n\t\thiveConfs:  map[string]string{},\n\t\thiveVars:   map[string]string{},\n\t}\n}\n\nfunc parseHiveConnectionString(raw string) (parsedHiveConnection, error) {\n\tvalue := strings.TrimSpace(raw)\n\tif value == \"\" {\n\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 {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/config.go#L287-L323","documentation":"parseHiveConnection accepts JDBC-style (jdbc:hive2://) or hive:// URLs. For a hive:// value that url.Parse cannot handle, the driver wraps the parse error. This surfaces malformed connection strings early before any network attempt.","triggerScenarios":"Calling the Hive connection parser with a value starting with hive:// that contains invalid URL syntax (e.g. raw spaces, bad percent-encoding like %zz, control characters).","commonSituations":"Copy-pasting a connection string with hidden whitespace, unencoded special characters in passwords, or hand-editing config files.","solutions":["Fix the connection string to be a valid URL: percent-encode special characters in user/password (e.g. @ -> %40)","Trim whitespace and control characters from the value before passing it","Use the jdbc:hive2:// form instead, which bypasses url.Parse","Validate the URL in a test before deploying config"],"exampleFix":"// before\nresult, err := parseHiveConnection(\"hive://us er:pa@ss@host:10000/default\")\n// after\nresult, err := parseHiveConnection(\"hive://us%20user:pa%40ss@host:10000/default\")","handlingStrategy":"validation","validationCode":"// Validate before calling the parser\nu, err := url.Parse(connStr)\nif err != nil || (u.Scheme != \"hive\" && u.Scheme != \"jdbc\") {\n    return fmt.Errorf(\"invalid Hive connection string %q: %v\", connStr, err)\n}","typeGuard":"func isValidHiveURL(s string) bool {\n    u, err := url.Parse(s)\n    return err == nil && (u.Scheme == \"hive\" || strings.HasPrefix(strings.ToLower(s), \"jdbc:hive2://\"))\n}","tryCatchPattern":"conn, err := parseHiveConnection(raw)\nif err != nil && strings.Contains(err.Error(), \"invalid Hive connection string\") {\n    // surface config error to operator with the offending key\n    return configError{key: \"hive.url\", cause: err}\n}","preventionTips":["Percent-encode user info in URLs (url.QueryEscape/PathEscape)","Trim whitespace from config values at load time","Store connection strings in one templated place, not scattered configs","Unit-test your config loader with real secrets containing special chars"],"tags":["hive","config","url-parsing"],"backgroundTag":"invalid-connection-string","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"}