t8y2/dbx · error
invalid Cassandra URL parameters: %w
Error message
invalid Cassandra URL parameters: %w
What it means
parseURLParams wraps a url.ParseQuery failure with "invalid Cassandra URL parameters: %w". The query-string portion of the connection string (or config URL) could not be decoded — typically malformed percent-encoding or an ill-formed key/value sequence — so no parameters can be applied.
Source
Thrown at agents/drivers/cassandra-go/config.go:154
config.port = parsedPort
}
if keyspace := strings.Trim(strings.TrimSpace(parsed.Path), "/"); keyspace != "" {
config.keyspace = keyspace
}
for key, values := range parsed.Query() {
params[key] = values
}
return nil
}
func parseURLParams(raw string) (url.Values, error) {
raw = strings.TrimPrefix(strings.TrimSpace(raw), "?")
if raw == "" {
return url.Values{}, nil
}
values, err := url.ParseQuery(raw)
if err != nil {
return nil, fmt.Errorf("invalid Cassandra URL parameters: %w", err)
}
return values, nil
}
func applyCassandraURLParams(config *cassandraConfig, params url.Values) error {
for rawKey, values := range params {
if len(values) == 0 {
continue
}
key := normalizeOptionName(rawKey)
value := strings.TrimSpace(values[len(values)-1])
switch key {
case "localdatacenter", "datacenter", "dc":
config.localDatacenter = value
case "requesttimeout", "timeout":
duration, err := parseDurationOption(value)
if err != nil {
return fmt.Errorf("invalid requesttimeout: %w", err)View on GitHub (pinned to c0390bff16)
Solutions
- Inspect the wrapped error to find the offending escape/segment.
- Percent-encode reserved characters (use url.QueryEscape on values, e.g. spaces -> %20).
- Separate parameters with '&' and always use key=value form.
- Pre-validate the query portion with url.ParseQuery before calling the driver.
Example fix
// before
driver.Open("cassandra://host:9042/sales?ssl=true%zz")
// after
driver.Open("cassandra://host:9042/sales?ssl=true")
// or build params programmatically:
q := url.Values{}
q.Set("ssl", "true")
u.RawQuery = q.Encode() Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(strings.TrimPrefix(dsn, "jdbc:"))
if err == nil && u.RawQuery != "" {
if _, err := url.ParseQuery(strings.TrimPrefix(u.RawQuery, "?")); err != nil {
return fmt.Errorf("bad query string: %v", err)
}
} Try / catch
conn, err := driver.Open(dsn)
if err != nil && strings.Contains(err.Error(), "invalid Cassandra URL parameters") {
return nil, fmt.Errorf("malformed query string in DSN; encode values with url.QueryEscape and join with '&': %w", err)
} Prevention
- Build query strings with url.Values.Encode() instead of manual concatenation.
- Percent-escape any values containing '%', spaces, or reserved characters.
- Use '&' (not ';') between parameters.
- Pre-validate the query portion with url.ParseQuery in config loading.
When it happens
Trigger: parseCassandraConfig calls parseURLParams with a query string containing bad escapes or broken structure, e.g. "?ssl=true%zz" or "?ssl" fragments the parser rejects, rather than valid key=value pairs joined by &.
Common situations: Hand-edited connection strings with an unescaped '%' (e.g. passwords embedded in query values); double-encoded parameters (%2520); semicolons used instead of '&' as separators after migrating from JDBC DSN style; truncated strings.
Related errors
- unsupported Cassandra connection string: %s
- invalid Cassandra connection string: %w
- Hive connection string must start with jdbc:hive2:// or hive
- Cassandra host is required
- unsupported Cassandra connection scheme: %s
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/557ce30182bdeffd.
Report an issue: GitHub.