{"id":"977a74a67d37ec1f","repo":"go-redis/redis","slug":"georadiusstore-requires-store-or-storedist","errorCode":null,"errorMessage":"GeoRadiusStore requires Store or StoreDist","messagePattern":"GeoRadiusStore requires Store or StoreDist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"geo_commands.go","lineNumber":59,"sourceCode":"\tctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,\n) *GeoLocationCmd {\n\tcmd := NewGeoLocationCmd(ctx, query, \"georadius_ro\", key, longitude, latitude)\n\tif query.Store != \"\" || query.StoreDist != \"\" {\n\t\tcmd.SetErr(errors.New(\"GeoRadius does not support Store or StoreDist\"))\n\t\treturn cmd\n\t}\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// GeoRadiusStore is a writing GEORADIUS command.\nfunc (c cmdable) GeoRadiusStore(\n\tctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,\n) *IntCmd {\n\targs := geoLocationArgs(query, \"georadius\", key, longitude, latitude)\n\tcmd := NewIntCmd(ctx, args...)\n\tif query.Store == \"\" && query.StoreDist == \"\" {\n\t\tcmd.SetErr(errors.New(\"GeoRadiusStore requires Store or StoreDist\"))\n\t\treturn cmd\n\t}\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// GeoRadiusByMember queries a geospatial index for members within a distance from a member.\n// This is a read-only variant that does not support Store or StoreDist options.\n//\n// Deprecated: Use GeoSearch with BYRADIUS and FROMMEMBER arguments instead as of Redis 6.2.0.\nfunc (c cmdable) GeoRadiusByMember(\n\tctx context.Context, key, member string, query *GeoRadiusQuery,\n) *GeoLocationCmd {\n\tcmd := NewGeoLocationCmd(ctx, query, \"georadiusbymember_ro\", key, member)\n\tif query.Store != \"\" || query.StoreDist != \"\" {\n\t\tcmd.SetErr(errors.New(\"GeoRadiusByMember does not support Store or StoreDist\"))\n\t\treturn cmd\n\t}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/geo_commands.go#L41-L77","documentation":"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.","triggerScenarios":"Calling client.GeoRadiusStore(ctx, key, lon, lat, &GeoRadiusQuery{}) with both Store and StoreDist empty.","commonSituations":"Default-initializing GeoRadiusQuery and forgetting to set the destination, or intending a read but calling the *Store method.","solutions":["Set query.Store or query.StoreDist to the destination key.","Use client.GeoRadius(...) instead if you do not want to store."],"exampleFix":"// before\nclient.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{})\n// after\nclient.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: \"dest\"})","handlingStrategy":"validation","validationCode":"if query.Store == \"\" && query.StoreDist == \"\" {\n    query.Store = \"dest\"\n}\nclient.GeoRadiusStore(ctx, key, lon, lat, query)","typeGuard":"func hasStoreDest(q *redis.GeoRadiusQuery) bool {\n    return q.Store != \"\" || q.StoreDist != \"\"\n}","tryCatchPattern":"cmd := client.GeoRadiusStore(ctx, key, lon, lat, query)\nif err := cmd.Err(); err != nil && strings.Contains(err.Error(), \"requires Store\") {\n    query.Store = \"dest\"\n    cmd = client.GeoRadiusStore(ctx, key, lon, lat, query)\n}","preventionTips":["Always set Store/StoreDist when calling the *Store variant.","Use the plain read method if no destination is needed."],"tags":["geo","georadius","validation"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}