{"id":"15ade9c945f1442b","repo":"go-redis/redis","slug":"invalid-maintenance-notifications-setting-must-be","errorCode":null,"errorMessage":"invalid maintenance notifications setting (must be 'disabled', 'enabled', or 'auto')","messagePattern":"invalid maintenance notifications setting \\(must be 'disabled', 'enabled', or 'auto'\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"maintnotifications/errors.go","lineNumber":16,"sourceCode":"package maintnotifications\n\nimport (\n\t\"errors\"\n\n\t\"github.com/redis/go-redis/v9/internal/maintnotifications/logs\"\n)\n\n// Configuration errors\nvar (\n\tErrInvalidRelaxedTimeout             = errors.New(logs.InvalidRelaxedTimeoutError())\n\tErrInvalidHandoffTimeout             = errors.New(logs.InvalidHandoffTimeoutError())\n\tErrInvalidHandoffWorkers             = errors.New(logs.InvalidHandoffWorkersError())\n\tErrInvalidHandoffQueueSize           = errors.New(logs.InvalidHandoffQueueSizeError())\n\tErrInvalidPostHandoffRelaxedDuration = errors.New(logs.InvalidPostHandoffRelaxedDurationError())\n\tErrInvalidEndpointType               = errors.New(logs.InvalidEndpointTypeError())\n\tErrInvalidMaintNotifications         = errors.New(logs.InvalidMaintNotificationsError())\n\tErrMaxHandoffRetriesReached          = errors.New(logs.MaxHandoffRetriesReachedError())\n\n\t// Configuration validation errors\n\n\t// ErrInvalidHandoffRetries is returned when the number of handoff retries is invalid\n\tErrInvalidHandoffRetries = errors.New(logs.InvalidHandoffRetriesError())\n)\n\n// Integration errors\nvar (\n\t// ErrInvalidClient is returned when the client does not support push notifications\n\tErrInvalidClient = errors.New(logs.InvalidClientError())\n)\n\n// Handoff errors\nvar (\n\t// ErrHandoffQueueFull is returned when the handoff queue is full","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/maintnotifications/errors.go#L1-L34","documentation":"Returned by Config.Validate() (maintnotifications/config.go:189-191) when Config.Mode is not one of the three valid modes. Mode controls how the client negotiates the CLIENT MAINT_NOTIFICATIONS ON handshake: ModeDisabled (off), ModeEnabled (require server support, fail hard if missing), ModeAuto (try then silently disable) — defined at config.go:17-21.","triggerScenarios":"Assigning a custom Mode string (e.g. 'on', 'true', 'yes', 'force') to Options.MaintNotificationsConfig.Mode, then constructing a client that triggers Validate().","commonSituations":"Mapping a boolean 'enable_maint_notifications=true' env flag to the Mode string 'true'; a typo like 'enable' vs 'enabled'; an older docs example using a since-renamed value.","solutions":["Use a typed Mode constant: maintnotifications.ModeAuto (default), ModeEnabled, or ModeDisabled.","When wiring from a config value, normalize booleans/strings into one of the three constants explicitly.","Call Mode.IsValid() (config.go:24) early to produce a targeted error."],"exampleFix":"// before\ncfg := &maintnotifications.Config{Mode: maintnotifications.Mode(\"true\")}\n\n// after\ncfg := &maintnotifications.Config{Mode: maintnotifications.ModeAuto}","handlingStrategy":"validation","validationCode":"if !cfg.Mode.IsValid() {\n    cfg.Mode = maintnotifications.ModeAuto\n}\nif err := cfg.Validate(); err != nil {\n    return fmt.Errorf(\"maint config: %w\", err)\n}","typeGuard":"func validMode(m maintnotifications.Mode) bool { return m.IsValid() }","tryCatchPattern":null,"preventionTips":["Normalize boolean 'enable' flags into Mode constants explicitly.","Default to ModeAuto for safety.","Reject unknown mode strings at config-load time with a clear message."],"tags":["maintnotifications","config","validation","mode"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}