{"id":"037737e619eab98a","repo":"go-redis/redis","slug":"circuit-breaker-max-requests-must-be-1","errorCode":null,"errorMessage":"circuit breaker max requests must be >= 1","messagePattern":"circuit breaker max requests must be >= 1","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"maintnotifications/errors.go","lineNumber":75,"sourceCode":"var (\n\t// ErrShutdown is returned when the maintnotifications manager is shutdown\n\tErrShutdown = errors.New(logs.ShutdownError())\n)\n\n// circuit breaker errors\nvar (\n\t// ErrCircuitBreakerOpen is returned when the circuit breaker is open\n\tErrCircuitBreakerOpen = errors.New(logs.CircuitBreakerOpenErrorMessage)\n)\n\n// circuit breaker configuration errors\nvar (\n\t// ErrInvalidCircuitBreakerFailureThreshold is returned when the circuit breaker failure threshold is invalid\n\tErrInvalidCircuitBreakerFailureThreshold = errors.New(logs.InvalidCircuitBreakerFailureThresholdError())\n\t// ErrInvalidCircuitBreakerResetTimeout is returned when the circuit breaker reset timeout is invalid\n\tErrInvalidCircuitBreakerResetTimeout = errors.New(logs.InvalidCircuitBreakerResetTimeoutError())\n\t// ErrInvalidCircuitBreakerMaxRequests is returned when the circuit breaker max requests is invalid\n\tErrInvalidCircuitBreakerMaxRequests = errors.New(logs.InvalidCircuitBreakerMaxRequestsError())\n)\n","sourceCodeStart":57,"sourceCodeEnd":77,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/maintnotifications/errors.go#L57-L77","documentation":"Returned by Config.Validate() (maintnotifications/config.go:184-186) when Config.CircuitBreakerMaxRequests < 1. This is the number of probe requests allowed through in half-open state to test endpoint recovery (circuit_breaker.go:118). At least one probe is required for the breaker to ever transition back to closed.","triggerScenarios":"Setting Options.MaintNotificationsConfig.CircuitBreakerMaxRequests to 0 or negative, then constructing the client (Validate runs).","commonSituations":"Setting it to 0 to 'minimize probe traffic' (instead it breaks validation); computing from a fraction that rounds to 0; stale config.","solutions":["Set CircuitBreakerMaxRequests to >=1 (default is 3).","For minimal probing use 1; never 0.","Clamp externally sourced values to a minimum of 1."],"exampleFix":"// before\ncfg := &maintnotifications.Config{CircuitBreakerMaxRequests: 0}\n\n// after\ncfg := &maintnotifications.Config{CircuitBreakerMaxRequests: 3}","handlingStrategy":"validation","validationCode":"if cfg.CircuitBreakerMaxRequests < 1 {\n    cfg.CircuitBreakerMaxRequests = 3\n}\nif err := cfg.Validate(); err != nil {\n    return fmt.Errorf(\"maint config: %w\", err)\n}","typeGuard":"func validMaxRequests(n int) bool { return n >= 1 }","tryCatchPattern":null,"preventionTips":["Never set MaxRequests to 0; use 1 for minimal probing.","Clamp externally sourced values to >=1.","Validate config in unit tests."],"tags":["maintnotifications","config","validation","circuit-breaker"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}