t8y2/dbx · error
invalid Hive port: %w
Error message
invalid Hive port: %w
What it means
When parsing a hive:// URL, the port segment is converted with strconv.Atoi; if it is not a valid integer, the driver rejects the whole connection string with this wrapped error. This guards against ports like 'host:abc' before any dial is attempted.
Source
Thrown at agents/drivers/hive-go/config.go:319
return newParsedHiveConnection(), nil
}
if strings.HasPrefix(strings.ToLower(value), "jdbc:hive2://") {
value = value[len("jdbc:hive2://"):]
} else if strings.HasPrefix(strings.ToLower(value), "hive://") {
parsedURL, err := url.Parse(value)
if err != nil {
return parsedHiveConnection{}, fmt.Errorf("invalid Hive connection string: %w", err)
}
result := newParsedHiveConnection()
if parsedURL.User != nil {
result.username = parsedURL.User.Username()
result.password, _ = parsedURL.User.Password()
}
port := defaultHivePort
if parsedURL.Port() != "" {
parsedPort, err := strconv.Atoi(parsedURL.Port())
if err != nil {
return parsedHiveConnection{}, fmt.Errorf("invalid Hive port: %w", err)
}
port = parsedPort
}
result.endpoints = []endpoint{{Host: parsedURL.Hostname(), Port: port}}
result.database = strings.Trim(parsedURL.Path, "/")
for key, entries := range parsedURL.Query() {
if len(entries) > 0 {
setCaseInsensitive(result.parameters, key, entries[len(entries)-1])
}
}
return result, nil
} else {
return parsedHiveConnection{}, errors.New("Hive connection string must start with jdbc:hive2:// or hive://")
}
result := newParsedHiveConnection()
if fragment := strings.IndexByte(value, '#'); fragment >= 0 {
result.hiveVars = parseHiveAssignments(value[fragment+1:], false)View on GitHub (pinned to c0390bff16)
Solutions
- Correct the port in the hive:// URL to a decimal integer 1-65535
- Omit the port entirely to use defaultHivePort
- Use host:port list syntax instead of hive:// URL syntax
- Inspect the wrapped strconv error to identify the offending token
Example fix
// before url := "hive://coordinator:10OOO/default" // letter O instead of zero // after url := "hive://coordinator:10000/default"
Defensive patterns
Strategy: validation
Validate before calling
if u, err := url.Parse(dsn); err == nil && u.Port() != "" {
if p, err := strconv.Atoi(u.Port()); err != nil || p < 1 || p > 65535 {
return fmt.Errorf("bad hive port %q", u.Port())
}
} Try / catch
conn, err := ParseHiveConnection(dsn)
if err != nil {
if strings.Contains(err.Error(), "invalid Hive port") {
return fmt.Errorf("port in DSN must be numeric: %w", err)
}
return err
} Prevention
- Always specify ports as decimal digits 1-65535
- Omit the port to use defaultHivePort
- Check templated DSNs for unreplaced placeholders
When it happens
Trigger: A hive:// URL whose explicit port is non-numeric, e.g. hive://host:notaport or hive://host: (empty handled separately but ':' trailing digits missing), or a port with stray characters like '10000x'.
Common situations: Typo in port; placeholder text left in a template (host:PORT); copying 'host:10000/default' fragments where the slash/DB bled into the port token (though url.Parse would normally isolate that).
Related errors
- invalid Hive port: %w
- invalid Hive connection string: %w
- invalid Hive endpoint %q: %w
- invalid Hive browserResponsePort %q: expected 0-65535
- invalid Hive connection string: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/4839ba5937f3508c.
Report an issue: GitHub.