{"record":{"id":"6c06245a42a92de6","repo":"t8y2/dbx","slug":"unsupported-cassandra-connection-string-s","errorCode":null,"errorMessage":"unsupported Cassandra connection string: %s","messagePattern":"unsupported Cassandra connection string: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config.go","lineNumber":115,"sourceCode":"\t\t}\n\t}\n\tif err := config.finalize(); err != nil {\n\t\treturn cassandraConfig{}, err\n\t}\n\tif len(config.hosts) == 0 && config.secureConnectBundle == \"\" {\n\t\treturn cassandraConfig{}, fmt.Errorf(\"Cassandra host is required\")\n\t}\n\tif len(config.hosts) > 0 && !config.disableInitialHostLookup && allLoopbackHosts(config.hosts) {\n\t\tconfig.disableInitialHostLookup = true\n\t}\n\treturn config, nil\n}\n\nfunc applyConnectionString(config *cassandraConfig, params url.Values, raw string) error {\n\tvalue := strings.TrimSpace(raw)\n\tvalue = strings.TrimPrefix(value, \"jdbc:\")\n\tif !strings.Contains(value, \"://\") {\n\t\treturn fmt.Errorf(\"unsupported Cassandra connection string: %s\", raw)\n\t}\n\tparsed, err := url.Parse(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid Cassandra connection string: %w\", err)\n\t}\n\tif parsed.Scheme != \"cassandra\" {\n\t\treturn fmt.Errorf(\"unsupported Cassandra connection scheme: %s\", parsed.Scheme)\n\t}\n\tif parsed.User != nil {\n\t\tconfig.username = parsed.User.Username()\n\t\tif password, ok := parsed.User.Password(); ok {\n\t\t\tconfig.password = password\n\t\t}\n\t}\n\tconfig.hosts = splitHosts(parsed.Host)\n\tif port := parsed.Port(); port != \"\" {\n\t\tparsedPort, parseErr := strconv.Atoi(port)\n\t\tif parseErr != nil || parsedPort < 1 || parsedPort > 65535 {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config.go#L97-L133","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","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."],"exampleFix":"// before\ndriver.Open(\"host=10.0.0.5;port=9042;keyspace=sales\")\n// after\ndriver.Open(\"cassandra://10.0.0.5:9042/sales\")","handlingStrategy":"validation","validationCode":"func validCassandraDSN(dsn string) bool {\n    v := strings.TrimPrefix(strings.TrimSpace(dsn), \"jdbc:\")\n    return strings.Contains(v, \"://\")\n}\nif !validCassandraDSN(dsn) {\n    return fmt.Errorf(\"DSN must be cassandra://... style URL\")\n}","typeGuard":null,"tryCatchPattern":"conn, err := driver.Open(dsn)\nif err != nil && strings.Contains(err.Error(), \"unsupported Cassandra connection string\") {\n    return nil, fmt.Errorf(\"got %q; expected cassandra://[user:pass@]host[:port][/keyspace]: %w\", dsn, err)\n}","preventionTips":["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."],"tags":["configuration","cassandra","connection-string","url-parsing"],"backgroundTag":"invalid-connection-string","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}