redis/go-redis

Redis doesn't have the 'client maint_notifications' subcommand

Closed this issue ยท 13 comments

cxljs commented

When using go-redis version 9.15.0 or above, an error is returned:

redis.go:464: auto mode fallback: maintnotifications disabled due to handshake error: ERR unknown subcommand 'maint_notifications'.

The reason is go-redis call the command in function:

func (c cmdable) ClientMaintNotifications(ctx context.Context, enabled bool, endpointType string) *StatusCmd {

but Redis does not have the 'client maint_notifications' subcommand. Is this a new Redis command that hasn't been released yet?

Hello @cxljs 9.15.0 was released by mistake, and we've tried to retract the version (although unsuccessfully).
https://github.com/redis/go-redis/blob/master/go.mod#L13
The next version of the library would be 9.16.0

cxljs commented

@htemelski-redis Got it. Thank you for your explanation.

@htemelski-redis this error also affected us in production. could you file bug report to https://github.com/golang/go? redis is big org, you guys can sway and made Go/Google team to look into it.

Hello @nikolaydubina, it was a mistake on our end, for which I'd like to apologize

@cxljs Shouldn't this issue remain opened?

As of latest version (v9.16.0), the issue is still happening.

args := []interface{}{"client", "maint_notifications"}

Redis: v8.2.2
go redis: v9.16.0

redis.go:478: auto mode fallback: maintnotifications disabled due to handshake error: ERR unknown subcommand 'maint_notifications'. Try CLIENT HELP.

@htemelski-redis Thank you very much for your work, but I can also confirm that the error is still present.
redis version 8.2.2

github.com/redis/go-redis/v9 v9.16.0
redis: 2025/10/26 18:45:17 redis.go:478: auto mode fallback: maintnotifications disabled due to handshake error: ERR unknown subcommand 'maint_notifications'. Try CLIENT HELP.

github.com/redis/go-redis/v9 v9.15.0
..\..\go\pkg\mod\github.com\redis\go-redis\v9@v9.15.0\internal\pool\pool.go:809:47: undefined: errUnexpectedRead

github.com/redis/go-redis/v9 v9.14.0
Everything works as expected in this version.

Hello @cxljs, @fapo85, @st7yws, @hongster and @nikolaydubina. What you are observing in v9.16.0 is an info log. It is true, that a maint_notifications subcommand is tried to be delivered to the server and based on the response, the client will decide if it will enable or disable the maintnotifications feature. In other words, the client is trying to detect if the server supports maintenance notifications by default (the default option of

is ModeAuto).

You can disable this by setting it to ModeDisabled.

	rdb1 := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",

		// Explicitly disable maintenance notifications
		// This prevents the client from sending CLIENT MAINT_NOTIFICATIONS ON
		MaintNotificationsConfig: &maintnotifications.Config{
			Mode: maintnotifications.ModeDisabled,
		},
	})

I will add an example in the examples folder later this week, but generally speaking - if you are not using redis enterprise or redis cloud, you do not need the maintnotifications and it should be safe to disable them.

@fapo85 v9.15.0 was retracted as it was released by mistake, the err should be resolved in v9.16.0

@ndyakov maybe it makes sense to have it disabled by default? I think that 90% of lib users don't use cloud or enterprise

@hotrush the default options are aligned to the rest of the official libraries, where this option is set to auto. You can see in #3572 and later if you ran the example yourself, that there is almost no impact on performance (theoretically a small one during the first connection creation). The log message is there to help developers (and maintainers) resolving future issues.

In v10 we are planning to have a more sophisticated logger with different log levels, and this will be present only when INFO or DEBUG levels are selected.

I understand that it makes sense for this to be disabled by default, I was on the same page, but on the other hand there is no real harm in having it auto and working towards some type of negotiation of supported features between the server and the client.

@ndyakov i see, approach with different log levels makes sense.

fapo85 commented

Thank you very much for the explanation, it works.

	rdb1 := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",

		// Explicitly disable maintenance notifications
		// This prevents the client from sending CLIENT MAINT_NOTIFICATIONS ON
		MaintNotificationsConfig: &maintnotifications.Config{
			Mode: maintnotifications.ModeDisabled,
		},
	})

For anyone using this solution you have to import maintnotifications.

import (
	"github.com/redis/go-redis/v9"
	"github.com/redis/go-redis/v9/maintnotifications"
)

func main() {
	rdb1 := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",

		// Explicitly disable maintenance notifications
		// This prevents the client from sending CLIENT MAINT_NOTIFICATIONS ON
		MaintNotificationsConfig: &maintnotifications.Config{
			Mode: maintnotifications.ModeDisabled,
		},
	})
}