t8y2/dbx · error
invalid tcpnodelay option: %w
Error message
invalid tcpnodelay option: %w
What it means
The 'tcpnodelay' URL parameter must parse as a boolean via strconv.ParseBool. Invalid values are rejected with this wrapped error before any connection is attempted. tcpnodelay controls TCP_NODELAY on the driver's sockets.
Source
Thrown at agents/drivers/cassandra-go/config.go:230
config.pageSize = size
case "cqlversion":
config.cqlVersion = value
case "ssl", "enablessl":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid ssl option: %w", err)
}
config.ssl = enabled
case "hostverification", "verifyhostname", "sslhostnameverification", "hostnameverification":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid host verification option: %w", err)
}
config.hostVerification = enabled
case "tcpnodelay":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid tcpnodelay option: %w", err)
}
config.tcpNoDelay = enabled
case "keepalive":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid keepalive option: %w", err)
}
config.keepAlive = enabled
case "user":
config.username = value
case "password":
config.password = value
case "debug":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid debug option: %w", err)
}
config.debug = enabledView on GitHub (pinned to c0390bff16)
Solutions
- Use tcpnodelay=true or tcpnodelay=false (or 1/0).
- Ensure the parameter isn't empty (unset env vars produce 'tcpnodelay=').
- Drop the parameter if you want the driver default.
- Validate the generated URL query with url.ParseQuery before handing it to the driver.
Example fix
// before cassandra://host:9042?tcpnodelay=off // after cassandra://host:9042?tcpnodelay=false
Defensive patterns
Strategy: validation
Validate before calling
if v := os.Getenv("CASSANDRA_TCP_NODELAY"); v != "" {
if _, err := strconv.ParseBool(strings.TrimSpace(v)); err != nil {
return fmt.Errorf("CASSANDRA_TCP_NODELAY must be true/false, got %q", v)
}
} Type guard
func isParseBoolValue(v string) bool {
_, err := strconv.ParseBool(v)
return err == nil
} Try / catch
cfg, err := parseCassandraConfig(dsn)
if err != nil {
if strings.Contains(err.Error(), "invalid tcpnodelay option") {
return fmt.Errorf("tcpnodelay accepts only ParseBool values (true/false/1/0): %w", err)
}
return err
} Prevention
- Guard env-sourced flags against empty values ('tcpnodelay=')
- Adopt one boolean convention (true/false) repo-wide
- Quote shell interpolations to avoid splitting/whitespace in DSNs
When it happens
Trigger: tcpnodelay=yes, tcpnodelay=off, tcpnodelay= (empty), or tcpnodelay=0x1 in a cassandra:// URL.
Common situations: Reusing 'on/off' style flags from other tooling, empty values from unset environment variables, or shell scripts appending flags unquoted.
Related errors
- invalid keepalive option: %w
- invalid ssl option: %w
- invalid host verification option: %w
- invalid requesttimeout: %w
- invalid connecttimeout: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/16965ba34a97d51c.
Report an issue: GitHub.