go-redis/redis · error

redis: ModuleLoadex nil config

Error message

redis: ModuleLoadex nil config

What it means

Error "redis: ModuleLoadex nil config" thrown in go-redis/redis.

Source

Thrown at commands.go:895

func (c *ModuleLoadexConfig) toArgs() []interface{} {
	args := make([]interface{}, 3, 3+len(c.Conf)*3+len(c.Args)*2)
	args[0] = "MODULE"
	args[1] = "LOADEX"
	args[2] = c.Path
	for k, v := range c.Conf {
		args = append(args, "CONFIG", k, v)
	}
	for _, arg := range c.Args {
		args = append(args, "ARGS", arg)
	}
	return args
}

// ModuleLoadex Redis `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]` command.
func (c cmdable) ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd {
	if conf == nil {
		cmd := NewStringCmd(ctx)
		cmd.SetErr(errors.New("redis: ModuleLoadex nil config"))
		return cmd
	}
	cmd := NewStringCmd(ctx, conf.toArgs()...)
	_ = c(ctx, cmd)
	return cmd
}

/*
Monitor - represents a Redis MONITOR command, allowing the user to capture
and process all commands sent to a Redis server. This mimics the behavior of
MONITOR in the redis-cli.

Notes:
- Using MONITOR blocks the connection to the server for itself. It needs a dedicated connection
- The user should create a channel of type string
- This runs concurrently in the background. Trigger via the Start and Stop functions
See further: Redis MONITOR command: https://redis.io/commands/monitor
*/

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Pass a non-nil ModuleLoadexConfig to ModuleLoadex
  2. Construct the config struct (even if fields are defaults) before calling

When it happens

Trigger: Thrown at commands.go:895 when the library encounters an invalid state.

Common situations: Nil-check optional config pointers at the API boundary and return an early error.


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