t8y2/dbx · error

invalid ssl option: %w

Error message

invalid ssl option: %w

What it means

The 'ssl' (alias 'enablessl') URL parameter must be a boolean parseable by strconv.ParseBool (1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False). Any other value produces this wrapped error and aborts DSN parsing.

Source

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

			config.serialConsistency = value
		case "numconns", "connectionsperhost":
			count, err := strconv.Atoi(value)
			if err != nil || count < 1 || count > 32 {
				return fmt.Errorf("numconns must be between 1 and 32")
			}
			config.numConnections = count
		case "pagesize", "fetchsize":
			size, err := strconv.Atoi(value)
			if err != nil || size < 1 {
				return fmt.Errorf("pagesize must be positive")
			}
			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)

View on GitHub (pinned to c0390bff16)

Solutions

  1. Use ssl=true or ssl=1 to enable, ssl=false or ssl=0 to disable.
  2. Trim whitespace/newlines from values sourced from environment variables before building the URL.
  3. Normalize yes/on/enabled to true in whatever generates the connection string.
  4. URL-encode the value if it may contain stray characters.

Example fix

// before
cassandra://host:9042?ssl=yes
// after
cassandra://host:9042?ssl=true
Defensive patterns

Strategy: validation

Validate before calling

func parseStrictBool(v string) (bool, error) {
	b, err := strconv.ParseBool(strings.TrimSpace(v))
	if err != nil {
		return false, fmt.Errorf("%q is not a bool; use true/false/1/0", v)
	}
	return b, nil
}

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 ssl option") {
		return fmt.Errorf("ssl must be true/false (not yes/on): %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: ssl=yes, enablessl=on, ssl="true " (with whitespace), or ssl=enabled in a cassandra:// URL.

Common situations: Using human-friendly booleans ('yes'/'on'/'enabled') from YAML/env config, whitespace from environment variables, or locale-formatted values.

Understand the failure class

Related errors


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