t8y2/dbx · error

unsupported Cassandra reconnection policy: %s

Error message

unsupported Cassandra reconnection policy: %s

What it means

parseReconnectionPolicy only supports constant (ConstantReconnectionPolicy) and exponential (ExponentialReconnectionPolicy) reconnection policies. Any other policy class name is rejected with this error, echoing the original value.

Source

Thrown at agents/drivers/cassandra-go/config.go:565

			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)
	}
}

func simpleClassName(value string) string {
	value = strings.TrimSpace(value)
	prefix := value
	if open := strings.IndexByte(prefix, '('); open >= 0 {
		prefix = prefix[:open]
	}
	if dot := strings.LastIndexByte(prefix, '.'); dot >= 0 {
		return value[dot+1:]
	}
	return value
}

func applyRetryPolicies(cluster *gocql.ClusterConfig, config cassandraConfig) error {
	switch config.retryPolicy {
	case "":

View on GitHub (pinned to c0390bff16)

Solutions

  1. Use ConstantReconnectionPolicy(baseDelay, maxDelay) or ExponentialReconnectionPolicy(baseDelay, maxDelay)
  2. Check the exact class name spelling; matching uses the simple lowercased class name
  3. Remove the option to fall back to the default (constant) policy

Example fix

// before
reconnectionPolicy = FixedReconnectionPolicy(1000, 10000)
// after
reconnectionPolicy = ExponentialReconnectionPolicy(1000, 10000)
Defensive patterns

Strategy: validation

Validate before calling

var supportedReconnectPolicies = map[string]bool{
	"": true, "constantreconnectionpolicy": true, "exponentialreconnectionpolicy": true,
}
func validReconnectPolicy(v string) bool {
	return supportedReconnectPolicies[strings.ToLower(strings.TrimSpace(v))]
}

Try / catch

if _, _, _, err := parseReconnectionPolicy(raw); err != nil {
	return fmt.Errorf("%w; supported: ConstantReconnectionPolicy, ExponentialReconnectionPolicy", err)
}

Prevention

When it happens

Trigger: A reconnectionPolicy option whose simple class name is not ConstantReconnectionPolicy or ExponentialReconnectionPolicy (empty string maps to constant), from applyCassandraURLParams or applyJavaDriverHOCON.

Common situations: Configuring FixedReconnectionPolicy or a custom ReconnectionPolicy implementation, or typo-ing the class name.

Related errors


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