t8y2/dbx · error
unsupported Cassandra connection string: %s
Error message
unsupported Cassandra connection string: %s
What it means
applyConnectionString rejects connection strings that, after trimming whitespace and stripping an optional 'jdbc:' prefix, do not contain "://" — i.e. they are not URLs at all. The Cassandra driver only accepts cassandra:// (or jdbc:-prefixed cassandra://) style connection strings.
Source
Thrown at agents/drivers/cassandra-go/config.go:115
}
}
if err := config.finalize(); err != nil {
return cassandraConfig{}, err
}
if len(config.hosts) == 0 && config.secureConnectBundle == "" {
return cassandraConfig{}, fmt.Errorf("Cassandra host is required")
}
if len(config.hosts) > 0 && !config.disableInitialHostLookup && allLoopbackHosts(config.hosts) {
config.disableInitialHostLookup = true
}
return config, nil
}
func applyConnectionString(config *cassandraConfig, params url.Values, raw string) error {
value := strings.TrimSpace(raw)
value = strings.TrimPrefix(value, "jdbc:")
if !strings.Contains(value, "://") {
return fmt.Errorf("unsupported Cassandra connection string: %s", raw)
}
parsed, err := url.Parse(value)
if err != nil {
return fmt.Errorf("invalid Cassandra connection string: %w", err)
}
if parsed.Scheme != "cassandra" {
return fmt.Errorf("unsupported Cassandra connection scheme: %s", parsed.Scheme)
}
if parsed.User != nil {
config.username = parsed.User.Username()
if password, ok := parsed.User.Password(); ok {
config.password = password
}
}
config.hosts = splitHosts(parsed.Host)
if port := parsed.Port(); port != "" {
parsedPort, parseErr := strconv.Atoi(port)
if parseErr != nil || parsedPort < 1 || parsedPort > 65535 {View on GitHub (pinned to c0390bff16)
Solutions
- Rewrite the string as a URL: cassandra://[user:pass@]host[:port][/keyspace][?params].
- If it's a jdbc: string, ensure the inner part is still a URL (jdbc:cassandra://host:9042).
- Pass host/port/keyspace as separate parameters instead of a connection string.
- Check for missing scheme ('cassandra://') rather than just a typo.
Example fix
// before
driver.Open("host=10.0.0.5;port=9042;keyspace=sales")
// after
driver.Open("cassandra://10.0.0.5:9042/sales") Defensive patterns
Strategy: validation
Validate before calling
func validCassandraDSN(dsn string) bool {
v := strings.TrimPrefix(strings.TrimSpace(dsn), "jdbc:")
return strings.Contains(v, "://")
}
if !validCassandraDSN(dsn) {
return fmt.Errorf("DSN must be cassandra://... style URL")
} Try / catch
conn, err := driver.Open(dsn)
if err != nil && strings.Contains(err.Error(), "unsupported Cassandra connection string") {
return nil, fmt.Errorf("got %q; expected cassandra://[user:pass@]host[:port][/keyspace]: %w", dsn, err)
} Prevention
- Build DSNs with url.URL and String() instead of string concatenation of key=value pairs.
- Document that key=value JDBC-style DSNs are not accepted as connection strings.
- Add a unit test asserting the DSN format before driver.Open.
- Migrate legacy DSNs with a small converter that emits cassandra:// URLs.
When it happens
Trigger: Calling parseCassandraConfig with a connection string like "cassandra:host=10.0.0.5", "host=10.0.0.5;port=9042", or a bare hostname with no scheme and '://', instead of "cassandra://host:9042/keyspace".
Common situations: Pasting a JDBC key=value DSN from another driver (e.g. PostgreSQL's 'postgres:host=...') into the Cassandra URL field; using a plain hostname where a URL is required; old proprietary connection-string format from a previous client library.
Related errors
- Hive connection string must start with jdbc:hive2:// or hive
- invalid Cassandra connection string: %w
- unsupported Cassandra connection scheme: %s
- invalid Cassandra URL parameters: %w
- Cassandra host is required
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/6c06245a42a92de6.
Report an issue: GitHub.