{"id":"eb2c1e6872a9c9f7","repo":"go-redis/redis","slug":"handler-must-implement-push-notificationhandler","errorCode":null,"errorMessage":"handler must implement push.NotificationHandler","messagePattern":"handler must implement push\\.NotificationHandler","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters.go","lineNumber":107,"sourceCode":"\treturn func(ctx context.Context) (net.Conn, error) {\n\t\t// Extract network and address from the options\n\t\tnetwork := oa.options.Network\n\t\taddr := oa.options.Addr\n\t\treturn baseDialer(ctx, network, addr)\n\t}\n}\n\n// pushProcessorAdapter adapts a push.NotificationProcessor to implement interfaces.NotificationProcessor.\ntype pushProcessorAdapter struct {\n\tprocessor push.NotificationProcessor\n}\n\n// RegisterHandler registers a handler for a specific push notification name.\nfunc (ppa *pushProcessorAdapter) RegisterHandler(pushNotificationName string, handler interface{}, protected bool) error {\n\tif pushHandler, ok := handler.(push.NotificationHandler); ok {\n\t\treturn ppa.processor.RegisterHandler(pushNotificationName, pushHandler, protected)\n\t}\n\treturn errors.New(\"handler must implement push.NotificationHandler\")\n}\n\n// UnregisterHandler removes a handler for a specific push notification name.\nfunc (ppa *pushProcessorAdapter) UnregisterHandler(pushNotificationName string) error {\n\treturn ppa.processor.UnregisterHandler(pushNotificationName)\n}\n\n// GetHandler returns the handler for a specific push notification name.\nfunc (ppa *pushProcessorAdapter) GetHandler(pushNotificationName string) interface{} {\n\treturn ppa.processor.GetHandler(pushNotificationName)\n}\n","sourceCodeStart":89,"sourceCodeEnd":119,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/adapters.go#L89-L119","documentation":"Error \"handler must implement push.NotificationHandler\" thrown in go-redis/redis.","triggerScenarios":"Thrown at adapters.go:107 when the library encounters an invalid state.","commonSituations":"Defensively, declare handler types with explicit interface conformance checks (var _ push.NotificationHandler = (*MyHandler)(nil)) so mistakes are caught at compile time.","solutions":["Ensure the value passed as the push notification handler implements the push.NotificationHandler interface (it must have the handler method for the notification type, typically with a pointer receiver)","If the handler is a struct, register it with a pointer (push.RegisterHandler(..., &myHandler{})) so the interface is satisfied"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}