go-redis/redis · error
GeoRadiusStore requires Store or StoreDist
Error message
GeoRadiusStore requires Store or StoreDist
What it means
GeoRadiusStore is the writing GEORADIUS variant and requires a destination key. If neither GeoRadiusQuery.Store nor GeoRadiusQuery.StoreDist is set, the library rejects the call (geo_commands.go:58-60) rather than sending a no-op write.
Source
Thrown at geo_commands.go:59
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
}
// GeoRadiusByMember queries a geospatial index for members within a distance from a member.
// This is a read-only variant that does not support Store or StoreDist options.
//
// Deprecated: Use GeoSearch with BYRADIUS and FROMMEMBER arguments instead as of Redis 6.2.0.
func (c cmdable) GeoRadiusByMember(
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
}View on GitHub (pinned to 36d97525cd)
Solutions
- Set query.Store or query.StoreDist to the destination key.
- Use client.GeoRadius(...) instead if you do not want to store.
Example fix
// before
client.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{})
// after
client.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: "dest"}) Defensive patterns
Strategy: validation
Validate before calling
if query.Store == "" && query.StoreDist == "" {
query.Store = "dest"
}
client.GeoRadiusStore(ctx, key, lon, lat, query) Type guard
func hasStoreDest(q *redis.GeoRadiusQuery) bool {
return q.Store != "" || q.StoreDist != ""
} Try / catch
cmd := client.GeoRadiusStore(ctx, key, lon, lat, query)
if err := cmd.Err(); err != nil && strings.Contains(err.Error(), "requires Store") {
query.Store = "dest"
cmd = client.GeoRadiusStore(ctx, key, lon, lat, query)
} Prevention
- Always set Store/StoreDist when calling the *Store variant.
- Use the plain read method if no destination is needed.
When it happens
Trigger: Calling client.GeoRadiusStore(ctx, key, lon, lat, &GeoRadiusQuery{}) with both Store and StoreDist empty.
Common situations: Default-initializing GeoRadiusQuery and forgetting to set the destination, or intending a read but calling the *Store method.
Related errors
- GeoRadius does not support Store or StoreDist
- GeoRadiusByMember does not support Store or StoreDist
- GeoRadiusByMemberStore requires Store or StoreDist
- redis: at least one metric must be specified for HOTKEYS STA
- args should have the same number of keys and vals
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/977a74a67d37ec1f.json.
Report an issue: GitHub.