t8y2/dbx · error
%s must be between 1 and %d bytes
Error message
%s must be between 1 and %d bytes
What it means
After parsing, resolveMaxBufferSize range-checks the value: it must be at least 1 and at most maximumMaxBufferSize bytes. Zero, negative, or oversized values are rejected with this error naming the parameter and the allowed upper bound.
Source
Thrown at agents/drivers/zookeeper/connection.go:476
}
return defaultAuthScheme
}
func resolveMaxBufferSize(config connectionConfig) (int, error) {
configured := config.MaxBufferSize
if configured == nil {
value := strings.TrimSpace(connectionURLParams(config).Get(maxBufferSizeParam))
if value == "" {
return defaultMaxBufferSize, nil
}
parsed, err := strconv.Atoi(value)
if err != nil {
return 0, fmt.Errorf("%s must be an integer number of bytes", maxBufferSizeParam)
}
configured = &parsed
}
if *configured <= 0 || *configured > maximumMaxBufferSize {
return 0, fmt.Errorf("%s must be between 1 and %d bytes", maxBufferSizeParam, maximumMaxBufferSize)
}
return *configured, nil
}
func connectionURLParams(config connectionConfig) url.Values {
params := strings.TrimPrefix(strings.TrimSpace(config.URLParams), "?")
params = strings.ReplaceAll(params, ";", "&")
parsed, _ := url.ParseQuery(params)
return parsed
}
func hasTLSOptions(config connectionConfig) bool {
return config.SSL || firstNonBlank(
config.CACertPath,
config.ClientCertPath,
config.ClientKeyPath,
config.CertPath,
config.KeyPath,View on GitHub (pinned to c0390bff16)
Solutions
- Set max_buffer_size to a positive integer within 1..maximumMaxBufferSize bytes (see error message for the cap).
- Remove the parameter entirely to use the driver's default buffer size.
- Clamp or validate the configured value in code before building the DSN.
- Check for overflow/typo when computing the byte count programmatically.
Example fix
// before dsn := "zookeeper://zk1:2181?max_buffer_size=0" // meant "default" // after dsn := "zookeeper://zk1:2181" // omit param to use defaultMaxBufferSize
Defensive patterns
Strategy: validation
Validate before calling
func clampMaxBufferSize(v int) (int, error) {
if v <= 0 || v > maximumMaxBufferSize {
return 0, fmt.Errorf("max_buffer_size=%d out of range 1..%d; unset it to use the default", v, maximumMaxBufferSize)
}
return v, nil
} Try / catch
n, err := strconv.Atoi(cfg.MaxBufferSize)
if err == nil {
if _, verr := clampMaxBufferSize(n); verr != nil {
return configError(verr) // fail before connect; retrying won't help
}
} Prevention
- Treat 0/negative as "unset" in your own config layer instead of passing them through.
- Compute byte counts carefully to avoid overflow past the maximum.
- Validate ranges at config-load time.
When it happens
Trigger: Passing max_buffer_size=0, a negative number, or an integer above the driver's maximum allowed buffer size in the connection URL params during connect.
Common situations: Setting 0 thinking it means "unlimited/default", copying an upper bound from another driver that permits larger buffers, or computing the byte value incorrectly and overflowing the cap.
Related errors
- ZooKeeper server list is empty
- Unsupported auth_scheme %q; expected %q or %q
- base_sleep_time_ms must be non-negative
- max_retries must be non-negative
- ZooKeeper connect string contains no servers
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/e3ad5501b0257f89.
Report an issue: GitHub.