go-redis/redis · error

invalid endpoint type

Error message

invalid endpoint type

What it means

Returned by Config.Validate() (maintnotifications/config.go:194-196) when Config.EndpointType is not one of the six valid constants. EndpointType tells the server what address form to return in a MOVING notification so the client can dial the new endpoint correctly. Valid values are defined in config.go:42-49: auto, internal-ip, internal-fqdn, external-ip, external-fqdn, none.

Source

Thrown at maintnotifications/errors.go:15

package maintnotifications

import (
	"errors"

	"github.com/redis/go-redis/v9/internal/maintnotifications/logs"
)

// Configuration errors
var (
	ErrInvalidRelaxedTimeout             = errors.New(logs.InvalidRelaxedTimeoutError())
	ErrInvalidHandoffTimeout             = errors.New(logs.InvalidHandoffTimeoutError())
	ErrInvalidHandoffWorkers             = errors.New(logs.InvalidHandoffWorkersError())
	ErrInvalidHandoffQueueSize           = errors.New(logs.InvalidHandoffQueueSizeError())
	ErrInvalidPostHandoffRelaxedDuration = errors.New(logs.InvalidPostHandoffRelaxedDurationError())
	ErrInvalidEndpointType               = errors.New(logs.InvalidEndpointTypeError())
	ErrInvalidMaintNotifications         = errors.New(logs.InvalidMaintNotificationsError())
	ErrMaxHandoffRetriesReached          = errors.New(logs.MaxHandoffRetriesReachedError())

	// Configuration validation errors

	// ErrInvalidHandoffRetries is returned when the number of handoff retries is invalid
	ErrInvalidHandoffRetries = errors.New(logs.InvalidHandoffRetriesError())
)

// Integration errors
var (
	// ErrInvalidClient is returned when the client does not support push notifications
	ErrInvalidClient = errors.New(logs.InvalidClientError())
)

// Handoff errors
var (

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Use a typed EndpointType constant: maintnotifications.EndpointTypeAuto (safest default), EndpointTypeExternalIP, etc.
  2. If loading from config, map the string to a constant via a switch with a default that falls back to EndpointTypeAuto instead of passing the raw string.
  3. Call EndpointType.IsValid() (config.go:52) before constructing the client to fail with a clearer message.

Example fix

// before
cfg := &maintnotifications.Config{EndpointType: maintnotifications.EndpointType("external")}

// after
cfg := &maintnotifications.Config{EndpointType: maintnotifications.EndpointTypeExternalIP}
Defensive patterns

Strategy: validation

Validate before calling

if !cfg.EndpointType.IsValid() {
    cfg.EndpointType = maintnotifications.EndpointTypeAuto
}
if err := cfg.Validate(); err != nil {
    return fmt.Errorf("maint config: %w", err)
}

Type guard

func validEndpointType(e maintnotifications.EndpointType) bool {
    return e.IsValid()
}

Prevention

When it happens

Trigger: Assigning a raw string (e.g. 'external', 'public-ip', 'ip') to Options.MaintNotificationsConfig.EndpointType instead of one of the EndpointType* constants, then validating the config during client construction.

Common situations: Typing an endpoint type from memory that doesn't match a constant; loading the value from YAML/env without mapping it through the defined constants; a version upgrade that renamed a constant.

Related errors


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/4ba02b89c7cdf6ea.json. Report an issue: GitHub.