{"record":{"id":"e33dd9f5784c5b74","repo":"argoproj/argo-workflows","slug":"basedelay-cannot-be-less-than-0","errorCode":null,"errorMessage":"baseDelay cannot be less than 0","messagePattern":"baseDelay cannot be less than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/sqldb/session.go","lineNumber":65,"sourceCode":"\n// SessionProxyConfig contains configuration for creating a SessionProxy\ntype SessionProxyConfig struct {\n\tKubectlConfig kubernetes.Interface\n\tNamespace     string\n\tDBConfig      config.DBConfig\n\tUsername      string\n\tPassword      string\n\tMaxRetries    int\n\tBaseDelay     time.Duration\n\tMaxDelay      time.Duration\n}\n\nfunc validateProxyParams(proxy *SessionProxy) error {\n\tif proxy.maxRetries < 0 {\n\t\treturn fmt.Errorf(\"maxRetries cannot be less than 0\")\n\t}\n\tif proxy.baseDelay < 0 {\n\t\treturn fmt.Errorf(\"baseDelay cannot be less than 0\")\n\t}\n\tif proxy.maxDelay < 0 {\n\t\treturn fmt.Errorf(\"maxDelay cannot be less than 0\")\n\t}\n\tif proxy.retryMultiple < 0 {\n\t\treturn fmt.Errorf(\"retryMultiple cannot be less than 0\")\n\t}\n\treturn nil\n}\n\n// NewSessionProxy creates a new SessionProxy with the given configuration\nfunc NewSessionProxy(ctx context.Context, config SessionProxyConfig) (*SessionProxy, error) {\n\tdbType := dbTypeFromConfig(&config.DBConfig)\n\tproxy := &SessionProxy{\n\t\tkubectlConfig: config.KubectlConfig,\n\t\tnamespace:     config.Namespace,\n\t\tdbConfig:      &config.DBConfig,\n\t\tusername:      config.Username,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/sqldb/session.go#L47-L83","documentation":"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.","triggerScenarios":"Calling NewSessionProxy with SessionProxyConfig.BaseDelay < 0 (e.g. negative nanosecond duration), or DBConfig.DBReconnectConfig.BaseDelaySeconds < 0, which is converted to time.Duration before validation.","commonSituations":"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).","solutions":["Set BaseDelay (or DBReconnectConfig.BaseDelaySeconds) to 0 or positive — 0 falls back to the default 100ms.","Fix the config file value under dbReconnectConfig.baseDelaySeconds if negative.","If BaseDelay is computed from a constant times count, ensure the count/multiplier is non-negative.","Use time.ParseDuration-based values or typed constants to avoid unit/sign mistakes."],"exampleFix":"// before\nconfig: {dbReconnectConfig: {baseDelaySeconds: -2}}\n// after\nconfig: {dbReconnectConfig: {baseDelaySeconds: 1}}","handlingStrategy":"validation","validationCode":"if cfg.BaseDelay < 0 {\n    return fmt.Errorf(\"BaseDelay must be >= 0, got %s\", cfg.BaseDelay)\n}","typeGuard":null,"tryCatchPattern":"if err := NewSessionProxy(ctx, cfg); err != nil {\n    if strings.Contains(err.Error(), \"baseDelay cannot be less than 0\") {\n        cfg.BaseDelay = 0 // triggers 100ms default\n        return NewSessionProxy(ctx, cfg)\n    }\n    return err\n}","preventionTips":["Keep durations in seconds in YAML and convert once with a non-negative check.","Never compute durations by subtracting untrusted values.","Validate persistence config before applying it to the cluster.","Prefer omitting the field (defaults apply) over hand-computed values."],"tags":["validation","database","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}