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

  1. Set retries to a plain integer from 0 to 1000, e.g. retries=5
  2. Remove the retries parameter to use the library default
  3. 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

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


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/cd9f6e6436de1c8f. Report an issue: GitHub.