{"record":{"id":"557ce30182bdeffd","repo":"t8y2/dbx","slug":"invalid-cassandra-url-parameters-w","errorCode":null,"errorMessage":"invalid Cassandra URL parameters: %w","messagePattern":"invalid Cassandra URL parameters: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config.go","lineNumber":154,"sourceCode":"\t\tconfig.port = parsedPort\n\t}\n\tif keyspace := strings.Trim(strings.TrimSpace(parsed.Path), \"/\"); keyspace != \"\" {\n\t\tconfig.keyspace = keyspace\n\t}\n\tfor key, values := range parsed.Query() {\n\t\tparams[key] = values\n\t}\n\treturn nil\n}\n\nfunc parseURLParams(raw string) (url.Values, error) {\n\traw = strings.TrimPrefix(strings.TrimSpace(raw), \"?\")\n\tif raw == \"\" {\n\t\treturn url.Values{}, nil\n\t}\n\tvalues, err := url.ParseQuery(raw)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Cassandra URL parameters: %w\", err)\n\t}\n\treturn values, nil\n}\n\nfunc applyCassandraURLParams(config *cassandraConfig, params url.Values) error {\n\tfor rawKey, values := range params {\n\t\tif len(values) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tkey := normalizeOptionName(rawKey)\n\t\tvalue := strings.TrimSpace(values[len(values)-1])\n\t\tswitch key {\n\t\tcase \"localdatacenter\", \"datacenter\", \"dc\":\n\t\t\tconfig.localDatacenter = value\n\t\tcase \"requesttimeout\", \"timeout\":\n\t\t\tduration, err := parseDurationOption(value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid requesttimeout: %w\", err)","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config.go#L136-L172","documentation":"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.","triggerScenarios":"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 &.","commonSituations":"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.","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."],"exampleFix":"// before\ndriver.Open(\"cassandra://host:9042/sales?ssl=true%zz\")\n// after\ndriver.Open(\"cassandra://host:9042/sales?ssl=true\")\n// or build params programmatically:\nq := url.Values{}\nq.Set(\"ssl\", \"true\")\nu.RawQuery = q.Encode()","handlingStrategy":"validation","validationCode":"u, err := url.Parse(strings.TrimPrefix(dsn, \"jdbc:\"))\nif err == nil && u.RawQuery != \"\" {\n    if _, err := url.ParseQuery(strings.TrimPrefix(u.RawQuery, \"?\")); err != nil {\n        return fmt.Errorf(\"bad query string: %v\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"conn, err := driver.Open(dsn)\nif err != nil && strings.Contains(err.Error(), \"invalid Cassandra URL parameters\") {\n    return nil, fmt.Errorf(\"malformed query string in DSN; encode values with url.QueryEscape and join with '&': %w\", err)\n}","preventionTips":["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."],"tags":["configuration","cassandra","url-parsing","query-parameters"],"backgroundTag":"invalid-url-syntax","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"}