{"record":{"id":"83ee22cc49428309","repo":"t8y2/dbx","slug":"invalid-hive-connection-string-w-83ee22","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/hive-go/config.go","lineNumber":308,"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":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/config.go#L290-L326","documentation":"parseHiveConnection accepts either a JDBC-style 'jdbc:hive2://' URL, a plain 'hive://' URL, or host[:port][/db] syntax. When the value uses hive:// but Go's url.Parse cannot parse it, the function wraps the parse failure with this error and aborts connection setup before any network call.","triggerScenarios":"Passing a connection string starting with hive:// that is malformed — e.g. hive://%zz, unbalanced brackets in an IPv6 literal, or control characters — so url.Parse returns an error.","commonSituations":"Hand-edited DSNs with unencoded special characters in password or database segments; copy-pasted URLs that were truncated; templated configs where a variable expanded to something with stray '://'.","solutions":["Fix the hive:// URL syntax (percent-encode special characters, balance [ ] for IPv6 hosts)","Use the jdbc:hive2:// prefix form or plain host:port syntax which avoids url.Parse","Print/inspect the wrapped cause (%w) to see the exact url.Parse complaint","Validate the connection string before passing it to the driver"],"exampleFix":"// before\nurl := \"hive://user:p@ss[w ord@host:10000\"\n// after\nurl := \"hive://user:p%40ss%5Bw%20ord@host:10000/default\"","handlingStrategy":"validation","validationCode":"if strings.HasPrefix(strings.ToLower(dsn), \"hive://\") {\n    if _, err := url.Parse(dsn); err != nil {\n        return fmt.Errorf(\"bad hive DSN: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"conn, err := ParseHiveConnection(dsn)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid Hive connection string\") {\n        return fmt.Errorf(\"check hive:// URL syntax (percent-encode specials): %w\", err)\n    }\n    return err\n}","preventionTips":["Percent-encode user/password and path segments in hive:// URLs","Prefer jdbc:hive2:// or host:port forms for simple setups","Validate DSNs in config CI before deploy"],"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-14T00:17:10.932Z"}