go-redis/redis · error

GeoRadius does not support Store or StoreDist

Error message

GeoRadius does not support Store or StoreDist

What it means

GeoRadius uses the read-only GEORADIUS_RO command and explicitly rejects the Store/StoreDist query fields (geo_commands.go:44-46). Writing the result to a key requires the writing variant of GEORADIUS; the RO form cannot store, so the library fails fast before sending the command.

Source

Thrown at geo_commands.go:45

		args[2+3*i] = eachLoc.Longitude
		args[2+3*i+1] = eachLoc.Latitude
		args[2+3*i+2] = eachLoc.Name
	}
	cmd := NewIntCmd(ctx, args...)
	_ = c(ctx, cmd)
	return cmd
}

// GeoRadius queries a geospatial index for members within a distance from a coordinate.
// This is a read-only variant that does not support Store or StoreDist options.
//
// Deprecated: Use GeoSearch with BYRADIUS argument instead as of Redis 6.2.0.
func (c cmdable) GeoRadius(
	ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd {
	cmd := NewGeoLocationCmd(ctx, query, "georadius_ro", key, longitude, latitude)
	if query.Store != "" || query.StoreDist != "" {
		cmd.SetErr(errors.New("GeoRadius does not support Store or StoreDist"))
		return cmd
	}
	_ = c(ctx, cmd)
	return cmd
}

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

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Use client.GeoRadiusStore(...) to persist results to a key.
  2. Clear the Store and StoreDist fields if you only need the in-memory result.
  3. Prefer the modern GeoSearchStore API on Redis >= 6.2.

Example fix

// before
client.GeoRadius(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: "dest"})
// after
client.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: "dest"})
Defensive patterns

Strategy: validation

Validate before calling

if query.Store != "" || query.StoreDist != "" {
    return client.GeoRadiusStore(ctx, key, lon, lat, query)
}
return client.GeoRadius(ctx, key, lon, lat, query)

Type guard

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

Try / catch

cmd := client.GeoRadius(ctx, key, lon, lat, query)
if err := cmd.Err(); err != nil && strings.Contains(err.Error(), "does not support Store") {
    return client.GeoRadiusStore(ctx, key, lon, lat, query)
}

Prevention

When it happens

Trigger: Calling client.GeoRadius(ctx, key, lon, lat, &GeoRadiusQuery{Store: "dest"}) or with StoreDist set.

Common situations: Porting code from GEORADIUS (deprecated since Redis 6.2) where Store was permitted, or confusing the read-only GeoRadius with the writing GeoRadiusStore.

Related errors


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