t8y2/dbx · error

invalid host verification option: %w

Error message

invalid host verification option: %w

What it means

The host-verification URL parameters ('hostverification', 'verifyhostname', 'sslhostnameverification', 'hostnameverification') must parse as booleans via strconv.ParseBool. Any other string yields this error, preventing ambiguous TLS hostname-verification settings.

Source

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

			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)
			}
			config.keepAlive = enabled
		case "user":
			config.username = value
		case "password":
			config.password = value

View on GitHub (pinned to c0390bff16)

Solutions

  1. Use hostverification=true or false (strconv.ParseBool-compatible values: 1/t/T/TRUE/true/True, 0/f/F/FALSE/false/False).
  2. Strip quotes and whitespace from templated values before URL assembly.
  3. Note that setting this to false weakens TLS security; prefer true with proper certificates.
  4. Check the full error's %w cause to confirm it is a ParseBool syntax error.

Example fix

// before
cassandra://host:9042?ssl=true&verifyhostname=on
// after
cassandra://host:9042?ssl=true&verifyhostname=true
Defensive patterns

Strategy: validation

Validate before calling

v := strings.TrimSpace(strings.Trim(verifyHost, "\""))
if _, err := strconv.ParseBool(v); err != nil {
	return fmt.Errorf("verifyhostname must be true/false, got %q", verifyHost)
}

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 host verification option") {
		return fmt.Errorf("hostverification aliases accept only strconv.ParseBool values: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: hostverification=yes, verifyhostname=on, hostnameverification=TRUE ITALIC copy-paste variants, or values with trailing whitespace in a cassandra:// URL.

Common situations: Reusing 'yes/no' toggles from other DB connection strings, secrets templating inserting quoted strings ('"true"'), or users disabling verification with values the parser doesn't accept.

Related errors


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