{"record":{"id":"b48ec2a237d4ef53","repo":"redis/go-redis","slug":"failed-to-enable-maintnotifications-w","errorCode":null,"errorMessage":"failed to enable maintnotifications: %w","messagePattern":"failed to enable maintnotifications: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"redis.go","lineNumber":1095,"sourceCode":"\t\t\tif !isRedisError(maintNotifHandshakeErr) {\n\t\t\t\t// if not redis error, fail the connection\n\t\t\t\tcn.GetStateMachine().Transition(pool.StateClosed)\n\t\t\t\treturn maintNotifHandshakeErr\n\t\t\t}\n\t\t\tc.optLock.Lock()\n\t\t\t// handshake failed - check and modify config atomically\n\t\t\tswitch c.opt.MaintNotificationsConfig.Mode {\n\t\t\tcase maintnotifications.ModeEnabled:\n\t\t\t\t// enabled mode, fail the connection\n\t\t\t\tc.optLock.Unlock()\n\t\t\t\tcn.GetStateMachine().Transition(pool.StateClosed)\n\n\t\t\t\t// Record handshake failure metric\n\t\t\t\tif errorCallback := pool.GetMetricErrorCallback(); errorCallback != nil {\n\t\t\t\t\terrorCallback(ctx, \"HANDSHAKE_FAILED\", cn, \"HANDSHAKE_FAILED\", true, 0)\n\t\t\t\t}\n\n\t\t\t\treturn fmt.Errorf(\"failed to enable maintnotifications: %w\", maintNotifHandshakeErr)\n\t\t\tdefault: // will handle auto and any other\n\t\t\t\t// Disabling logging here as it's too noisy.\n\t\t\t\t// TODO: Enable when we have a better logging solution for log levels\n\t\t\t\t// internal.Logger.Printf(ctx, \"auto mode fallback: maintnotifications disabled due to handshake error: %v\", maintNotifHandshakeErr)\n\t\t\t\tc.opt.MaintNotificationsConfig.Mode = maintnotifications.ModeDisabled\n\t\t\t\tc.optLock.Unlock()\n\t\t\t\t// auto mode, disable maintnotifications and continue\n\t\t\t\tif initErr := c.disableMaintNotificationsUpgrades(); initErr != nil {\n\t\t\t\t\t// Log error but continue - auto mode should be resilient\n\t\t\t\t\tinternal.Logger.Printf(ctx, \"failed to disable maintnotifications in auto mode: %v\", initErr)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif !c.opt.DisableIdentity && !c.opt.DisableIndentity {\n\t\tlibName := \"\"\n\t\tlibVer := Version()","sourceCodeStart":1077,"sourceCodeEnd":1113,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/redis.go#L1077-L1113","documentation":"Error \"failed to enable maintnotifications: %w\" thrown in redis/go-redis.","triggerScenarios":"Thrown at redis.go:1095 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}