t8y2/dbx · error
retries must be between 0 and 1000
Error message
retries must be between 0 and 1000
What it means
The 'retries' URL parameter must be an integer between 0 and 1000 inclusive. This error is returned when strconv.Atoi fails or the parsed count is negative or greater than 1000, guarding against absurd retry counts that would hammer the cluster.
Source
Thrown at agents/drivers/cassandra-go/config.go:252
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 = enabled
case "retries":
count, err := strconv.Atoi(value)
if err != nil || count < 0 || count > 1000 {
return fmt.Errorf("retries must be between 0 and 1000")
}
config.retryCount = count
case "retry":
policy, err := normalizeRetryPolicy(value)
if err != nil {
return err
}
config.retryPolicy = policy
case "reconnection":
policy, baseDelay, maxDelay, err := parseReconnectionPolicy(value)
if err != nil {
return err
}
config.reconnectionPolicy = policy
config.reconnectionBaseDelay = baseDelay
config.reconnectionMaxDelay = maxDelay
case "disableinitialhostlookup":
disabled, err := strconv.ParseBool(value)View on GitHub (pinned to c0390bff16)
Solutions
- Set retries to a plain integer from 0 to 1000, e.g. retries=5
- Remove the retries parameter to use the library default
- If a higher retry count is truly needed, chain retries at the application level instead of exceeding the URL limit
Example fix
// before cassandra://127.0.0.1/myks?retries=unlimited // after cassandra://127.0.0.1/myks?retries=10
Defensive patterns
Strategy: validation
Validate before calling
n, err := strconv.Atoi(q.Get("retries"))
if err != nil || n < 0 || n > 1000 {
return errors.New("retries must be an integer 0..1000")
} Try / catch
if err := parseCassandraConfig(dsn); err != nil {
if strings.Contains(err.Error(), "retries must be between") {
return rewriteDSNParam(dsn, "retries", "3")
}
return err
} Prevention
- Always emit retries as a plain decimal integer
- Clamp user-supplied retry counts to 0..1000 before building the DSN
- Never put duration strings (30s) or 'unlimited' in retries
When it happens
Trigger: DSN contains retries=<value> where value is non-numeric (strconv.Atoi error), negative, or >1000, e.g. retries=-1 or retries=99999.
Common situations: Typos in the URL (retries=1O instead of 10); using sentinel values like 'unlimited'; migrating from configs that allowed larger retry counts; automated tools injecting duration-like strings (retries=30s).
Related errors
- unsupported Cassandra URL parameter: %s
- invalid requesttimeout: %w
- invalid connecttimeout: %w
- protocolversion must be between 3 and 5
- serialconsistency must be SERIAL or LOCAL_SERIAL
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/cd9f6e6436de1c8f.
Report an issue: GitHub.