go-redis/redis · error

GeoRadiusByMemberStore requires Store or StoreDist

Error message

GeoRadiusByMemberStore requires Store or StoreDist

What it means

GeoRadiusByMemberStore is the writing GEORADIUSBYMEMBER variant and requires Store or StoreDist to name a destination key (geo_commands.go:88-90). Without one, the command would be a pointless write, so it is rejected locally.

Source

Thrown at geo_commands.go:89

	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd {
	cmd := NewGeoLocationCmd(ctx, query, "georadiusbymember_ro", key, member)
	if query.Store != "" || query.StoreDist != "" {
		cmd.SetErr(errors.New("GeoRadiusByMember does not support Store or StoreDist"))
		return cmd
	}
	_ = c(ctx, cmd)
	return cmd
}

// GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (c cmdable) GeoRadiusByMemberStore(
	ctx context.Context, key, member string, query *GeoRadiusQuery,
) *IntCmd {
	args := geoLocationArgs(query, "georadiusbymember", key, member)
	cmd := NewIntCmd(ctx, args...)
	if query.Store == "" && query.StoreDist == "" {
		cmd.SetErr(errors.New("GeoRadiusByMemberStore requires Store or StoreDist"))
		return cmd
	}
	_ = c(ctx, cmd)
	return cmd
}

func (c cmdable) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd {
	args := make([]interface{}, 0, 13)
	args = append(args, "geosearch", key)
	args = geoSearchArgs(q, args)
	cmd := NewStringSliceCmd(ctx, args...)
	_ = c(ctx, cmd)
	return cmd
}

func (c cmdable) GeoSearchLocation(
	ctx context.Context, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd {

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Set query.Store or query.StoreDist.
  2. Use client.GeoRadiusByMember(...) if no storage is required.

Example fix

// before
client.GeoRadiusByMemberStore(ctx, key, m, &redis.GeoRadiusQuery{})
// after
client.GeoRadiusByMemberStore(ctx, key, m, &redis.GeoRadiusQuery{Store: "dest"})
Defensive patterns

Strategy: validation

Validate before calling

if query.Store == "" && query.StoreDist == "" {
    query.Store = "dest"
}
client.GeoRadiusByMemberStore(ctx, key, member, query)

Type guard

func hasStoreDest(q *redis.GeoRadiusQuery) bool {
    return q.Store != "" || q.StoreDist != ""
}

Try / catch

cmd := client.GeoRadiusByMemberStore(ctx, key, m, query)
if err := cmd.Err(); err != nil && strings.Contains(err.Error(), "requires Store") {
    query.Store = "dest"
    cmd = client.GeoRadiusByMemberStore(ctx, key, m, query)
}

Prevention

When it happens

Trigger: Calling client.GeoRadiusByMemberStore(ctx, key, member, &GeoRadiusQuery{}) with neither Store nor StoreDist.

Common situations: Reusing a GeoRadiusQuery zero value, or calling the *Store method while intending a read.

Related errors


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