argoproj/argo-workflows · error

baseDelay cannot be less than 0

Error message

baseDelay cannot be less than 0

What it means

validateProxyParams also rejects a negative baseDelay, the initial wait between reconnection attempts. A negative duration cannot be slept and would corrupt the backoff loop, so NewSessionProxy refuses it. Pure input validation.

Source

Thrown at util/sqldb/session.go:65

// SessionProxyConfig contains configuration for creating a SessionProxy
type SessionProxyConfig struct {
	KubectlConfig kubernetes.Interface
	Namespace     string
	DBConfig      config.DBConfig
	Username      string
	Password      string
	MaxRetries    int
	BaseDelay     time.Duration
	MaxDelay      time.Duration
}

func validateProxyParams(proxy *SessionProxy) error {
	if proxy.maxRetries < 0 {
		return fmt.Errorf("maxRetries cannot be less than 0")
	}
	if proxy.baseDelay < 0 {
		return fmt.Errorf("baseDelay cannot be less than 0")
	}
	if proxy.maxDelay < 0 {
		return fmt.Errorf("maxDelay cannot be less than 0")
	}
	if proxy.retryMultiple < 0 {
		return fmt.Errorf("retryMultiple cannot be less than 0")
	}
	return nil
}

// NewSessionProxy creates a new SessionProxy with the given configuration
func NewSessionProxy(ctx context.Context, config SessionProxyConfig) (*SessionProxy, error) {
	dbType := dbTypeFromConfig(&config.DBConfig)
	proxy := &SessionProxy{
		kubectlConfig: config.KubectlConfig,
		namespace:     config.Namespace,
		dbConfig:      &config.DBConfig,
		username:      config.Username,

View on GitHub (pinned to 35bff19146)

Solutions

  1. Set BaseDelay (or DBReconnectConfig.BaseDelaySeconds) to 0 or positive — 0 falls back to the default 100ms.
  2. Fix the config file value under dbReconnectConfig.baseDelaySeconds if negative.
  3. If BaseDelay is computed from a constant times count, ensure the count/multiplier is non-negative.
  4. Use time.ParseDuration-based values or typed constants to avoid unit/sign mistakes.

Example fix

// before
config: {dbReconnectConfig: {baseDelaySeconds: -2}}
// after
config: {dbReconnectConfig: {baseDelaySeconds: 1}}
Defensive patterns

Strategy: validation

Validate before calling

if cfg.BaseDelay < 0 {
    return fmt.Errorf("BaseDelay must be >= 0, got %s", cfg.BaseDelay)
}

Try / catch

if err := NewSessionProxy(ctx, cfg); err != nil {
    if strings.Contains(err.Error(), "baseDelay cannot be less than 0") {
        cfg.BaseDelay = 0 // triggers 100ms default
        return NewSessionProxy(ctx, cfg)
    }
    return err
}

Prevention

When it happens

Trigger: Calling NewSessionProxy with SessionProxyConfig.BaseDelay < 0 (e.g. negative nanosecond duration), or DBConfig.DBReconnectConfig.BaseDelaySeconds < 0, which is converted to time.Duration before validation.

Common situations: Negative baseDelaySeconds in the controller's persistence config YAML; a config template rendering a negative number; arithmetic producing a negative time.Duration (e.g. subtracting durations in the wrong order).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/e33dd9f5784c5b74. Report an issue: GitHub.