t8y2/dbx · error
invalid disableinitialhostlookup option: %w
Error message
invalid disableinitialhostlookup option: %w
What it means
The 'disableinitialhostlookup' URL parameter must be a valid Go boolean parseable by strconv.ParseBool. When parsing fails, the library wraps and returns this error rather than silently defaulting the option.
Source
Thrown at agents/drivers/cassandra-go/config.go:272
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)
if err != nil {
return fmt.Errorf("invalid disableinitialhostlookup option: %w", err)
}
config.disableInitialHostLookup = disabled
case "loadbalancing":
policy, err := normalizeLoadBalancingPolicy(value)
if err != nil {
return err
}
config.loadBalancingPolicy = policy
case "sslenginefactory":
if value != "" && !strings.EqualFold(simpleClassName(value), "DefaultSslEngineFactory") {
return fmt.Errorf("custom Cassandra sslenginefactory is not supported by the native agent: %s", value)
}
config.ssl = true
case "usekrb5":
enabled, err := strconv.ParseBool(value)
if err != nil {
return fmt.Errorf("invalid usekrb5 option: %w", err)
}View on GitHub (pinned to c0390bff16)
Solutions
- Use one of strconv.ParseBool's accepted literals: 1/t/T/TRUE/true/True or 0/f/F/FALSE/false/False
- Trim whitespace from the parameter value in the DSN
- Omit the parameter if the default behavior is fine
Example fix
// before cassandra://127.0.0.1/myks?disableinitialhostlookup=y // after cassandra://127.0.0.1/myks?disableinitialhostlookup=true
Defensive patterns
Strategy: validation
Validate before calling
func validBoolParam(v string) bool {
_, err := strconv.ParseBool(strings.TrimSpace(v))
return err == true || err == nil // err == nil means valid
}
// use: _, err := strconv.ParseBool(strings.TrimSpace(q.Get("disableinitialhostlookup"))); err == nil Try / catch
if err := parseCassandraConfig(dsn); err != nil {
if strings.Contains(err.Error(), "disableinitialhostlookup") {
return sanitizeBoolParams(dsn)
}
return err
} Prevention
- Use canonical true/false in connection strings
- Trim whitespace from parameter values before URL-building
- URL-encode parameter values to avoid stray %20
When it happens
Trigger: DSN contains disableinitialhostlookup=<value> with a non-boolean string such as 'yes', '1,' or a stray space, causing strconv.ParseBool to fail.
Common situations: Copy-pasted connection strings from Java driver docs using 'true '/'false ' with whitespace; using 'y'/'n' style flags; encoding issues injecting %20 into the value.
Related errors
- invalid debug option: %w
- invalid usekrb5 option: %w
- invalid disablepafxfast option: %w
- invalid usekeytab option: %w
- invalid useticketcache option: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/960fd538c18d10f8.
Report an issue: GitHub.