t8y2/dbx · error

unsupported Cassandra connection scheme: %s

Error message

unsupported Cassandra connection scheme: %s

What it means

applyConnectionString rejects URLs whose scheme is not "cassandra" with "unsupported Cassandra connection scheme: %s". The driver reserves its URL space for the cassandra scheme (after optional jdbc: prefix); http, cassandrads, or other schemes are refused even if otherwise well-formed.

Source

Thrown at agents/drivers/cassandra-go/config.go:122

	}
	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 {
			return fmt.Errorf("invalid Cassandra port: %s", port)
		}
		config.port = parsedPort
	}
	if keyspace := strings.Trim(strings.TrimSpace(parsed.Path), "/"); keyspace != "" {
		config.keyspace = keyspace
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Change the scheme to "cassandra" exactly (lowercase).
  2. Enable TLS via the ssl=true parameter instead of an https-style scheme.
  3. If it's a jdbc: string, ensure it is jdbc:cassandra://... not another product's JDBC URL.
  4. Route other protocols to their correct drivers, not the Cassandra one.

Example fix

// before
driver.Open("cql+ssl://10.0.0.5:9042/sales")
// after
driver.Open("cassandra://10.0.0.5:9042/sales?ssl=true")
Defensive patterns

Strategy: validation

Validate before calling

v := strings.TrimPrefix(strings.TrimSpace(dsn), "jdbc:")
if u, err := url.Parse(v); err == nil && u.Scheme != "cassandra" {
    return fmt.Errorf("scheme must be cassandra (got %q); use ?ssl=true for TLS", u.Scheme)
}

Try / catch

conn, err := driver.Open(dsn)
if err != nil && strings.Contains(err.Error(), "unsupported Cassandra connection scheme") {
    return nil, fmt.Errorf("use scheme 'cassandra' and enable TLS via ssl=true parameter: %w", err)
}

Prevention

When it happens

Trigger: Calling parseCassandraConfig with strings like "http://host:9042", "cql://host", "cassandra+ssl://host", or "jdbc:postgresql://host/db" — anything where parsed.Scheme != "cassandra".

Common situations: Reusing a URL from another driver/HTTP endpoint; inventing a scheme like cassandras or cqls for TLS instead of using the ssl parameter; leaving a placeholder scheme from example code.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/595675964bf57c62. Report an issue: GitHub.