t8y2/dbx · error
parse IoTDB connection string: %w
Error message
parse IoTDB connection string: %w
What it means
parseConnectionConfig parses the IoTDB connection string: it strips an optional 'jdbc:' prefix and runs url.Parse. If URL parsing fails, the error is wrapped as 'parse IoTDB connection string: %w'. This surfaces malformed connection strings early.
Source
Thrown at agents/drivers/iotdb/driver.go:117
if config.Host == "" {
config.Host = "127.0.0.1"
}
if config.Port <= 0 {
config.Port = defaultIoTDBPort
}
if config.Username == "" {
config.Username = "root"
}
if config.Password == "" {
config.Password = "root"
}
query := url.Values{}
if raw := strings.TrimSpace(params.ConnectionString); raw != "" {
normalized := strings.TrimPrefix(raw, "jdbc:")
parsed, err := url.Parse(normalized)
if err != nil {
return connectionConfig{}, fmt.Errorf("parse IoTDB connection string: %w", err)
}
if parsed.Scheme != "" && !strings.EqualFold(parsed.Scheme, "iotdb") {
return connectionConfig{}, fmt.Errorf("unsupported IoTDB connection scheme: %s", parsed.Scheme)
}
if parsed.Hostname() != "" {
config.Host = parsed.Hostname()
}
if parsed.Port() != "" {
port, err := strconv.Atoi(parsed.Port())
if err != nil || port <= 0 {
return connectionConfig{}, fmt.Errorf("invalid IoTDB port: %s", parsed.Port())
}
config.Port = port
}
if parsed.User != nil {
if username := parsed.User.Username(); username != "" {
config.Username = username
}View on GitHub (pinned to c0390bff16)
Solutions
- URL-encode the username/password (url.QueryEscape) before composing the string
- Validate the connection string with url.Parse in your own code before passing it
- Remove spaces/invalid characters; bracket IPv6 hosts
- Log the normalized (jdbc-stripped) string that failed to confirm the syntax problem
Example fix
// before
connStr := fmt.Sprintf("iotdb://%s:%s@host:6667", user, password) // password has '@'
// after
connStr := fmt.Sprintf("iotdb://%s:%s@host:6667", url.QueryEscape(user), url.QueryEscape(password)) Defensive patterns
Strategy: validation
Validate before calling
func validateIoTDBConnStr(raw string) error {
normalized := strings.TrimPrefix(strings.TrimSpace(raw), "jdbc:")
if _, err := url.Parse(normalized); err != nil {
return fmt.Errorf("invalid connection string: %w", err)
}
return nil
} Prevention
- URL-encode credentials with url.QueryEscape when composing strings
- Avoid spaces and raw special characters in connection strings
- Bracket IPv6 hosts and encode any '%' characters
When it happens
Trigger: Passing a ConnectionString with invalid URL syntax — e.g. unescaped characters, mismatched brackets in IPv6 host, or a ':' only host:port fragment like 'host:' — to newServer.
Common situations: Building the string by concatenation with an unencoded password containing '@' or ':'; forgetting jdbc: prefix handling and embedding spaces; IPv6 addresses without brackets.
Related errors
- unsupported IoTDB connection scheme: %s
- Hive connection string must start with jdbc:hive2:// or hive
- invalid Hive connection string: %w
- invalid Hive port: %w
- invalid Hive fetchSize %q: expected a positive integer
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/918532842d10a31e.
Report an issue: GitHub.