t8y2/dbx · error
invalid Cassandra reconnection policy delay: %s
Error message
invalid Cassandra reconnection policy delay: %s
What it means
parseReconnectionPolicy extracts numeric delay parameters from policy class arguments like ConstantReconnectionPolicy(1000, 10000). Each comma-separated part (with "(long)" casts stripped) must parse as a non-negative integer of seconds; otherwise this error names the offending part.
Source
Thrown at agents/drivers/cassandra-go/config.go:548
func parseReconnectionPolicy(value string) (string, time.Duration, time.Duration, error) {
trimmed := strings.TrimSpace(value)
name := simpleClassName(trimmed)
parameters := ""
if open := strings.IndexByte(name, '('); open >= 0 {
parameters = strings.TrimSuffix(name[open+1:], ")")
name = name[:open]
}
policy := strings.ToLower(strings.TrimSpace(name))
baseDelay := time.Second
maxDelay := 60 * time.Second
if parameters != "" {
parts := strings.Split(parameters, ",")
for index, part := range parts {
part = strings.TrimSpace(strings.ReplaceAll(strings.ToLower(part), "(long)", ""))
seconds, err := strconv.Atoi(part)
if err != nil || seconds < 0 {
return "", 0, 0, fmt.Errorf("invalid Cassandra reconnection policy delay: %s", part)
}
if index == 0 {
baseDelay = time.Duration(seconds) * time.Second
} else if index == 1 {
maxDelay = time.Duration(seconds) * time.Second
} else {
return "", 0, 0, fmt.Errorf("too many Cassandra reconnection policy parameters")
}
}
}
switch policy {
case "", "constantreconnectionpolicy":
return "constant", baseDelay, baseDelay, nil
case "exponentialreconnectionpolicy":
return "exponential", baseDelay, maxDelay, nil
default:
return "", 0, 0, fmt.Errorf("unsupported Cassandra reconnection policy: %s", value)
}View on GitHub (pinned to c0390bff16)
Solutions
- Supply plain integer seconds, e.g. ConstantReconnectionPolicy(1, 10) for 1s base and 10s max
- Remove any unit suffixes or casts other than "(long)"
- Ensure no parameter is negative
Example fix
// before reconnectionPolicy = ConstantReconnectionPolicy(1000ms, 10s) // after reconnectionPolicy = ConstantReconnectionPolicy(1000, 10)
Defensive patterns
Strategy: validation
Validate before calling
func validPolicyArgs(args string) bool {
for _, p := range strings.Split(args, ",") {
p = strings.TrimSpace(strings.ReplaceAll(strings.ToLower(p), "(long)", ""))
n, err := strconv.Atoi(p)
if err != nil || n < 0 {
return false
}
}
return true
} Try / catch
base, max, _, err := parseReconnectionPolicy(raw)
if err != nil {
return fmt.Errorf("reconnection args must be non-negative integer seconds: %w", err)
} Prevention
- Write delay arguments as plain integer seconds, no unit suffixes
- Strip Java-style casts except (long)
- Keep negative delays out of templates
When it happens
Trigger: A reconnection policy parameter string containing a non-numeric or negative value, e.g. "ConstantReconnectionPolicy(abc, 10)" or "(1000, -1)".
Common situations: Copying HOCON arguments with units like "1000ms" or "1s" instead of plain numbers, extra spaces/typos, or negative delays.
Related errors
- expected duration or positive milliseconds
- too many Cassandra reconnection policy parameters
- unsupported Cassandra reconnection policy: %s
- parse Cassandra configfile %s: %w
- invalid useKeyTab in Cassandra JAAS config: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/7195e134fb0a34de.
Report an issue: GitHub.