{"id":"d220877aced8a5dc","repo":"go-redis/redis","slug":"georadius-does-not-support-store-or-storedist","errorCode":null,"errorMessage":"GeoRadius does not support Store or StoreDist","messagePattern":"GeoRadius does not support Store or StoreDist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"geo_commands.go","lineNumber":45,"sourceCode":"\t\targs[2+3*i] = eachLoc.Longitude\n\t\targs[2+3*i+1] = eachLoc.Latitude\n\t\targs[2+3*i+2] = eachLoc.Name\n\t}\n\tcmd := NewIntCmd(ctx, args...)\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// GeoRadius queries a geospatial index for members within a distance from a coordinate.\n// This is a read-only variant that does not support Store or StoreDist options.\n//\n// Deprecated: Use GeoSearch with BYRADIUS argument instead as of Redis 6.2.0.\nfunc (c cmdable) GeoRadius(\n\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","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/geo_commands.go#L27-L63","documentation":"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.","triggerScenarios":"Calling client.GeoRadius(ctx, key, lon, lat, &GeoRadiusQuery{Store: \"dest\"}) or with StoreDist set.","commonSituations":"Porting code from GEORADIUS (deprecated since Redis 6.2) where Store was permitted, or confusing the read-only GeoRadius with the writing GeoRadiusStore.","solutions":["Use client.GeoRadiusStore(...) to persist results to a key.","Clear the Store and StoreDist fields if you only need the in-memory result.","Prefer the modern GeoSearchStore API on Redis >= 6.2."],"exampleFix":"// before\nclient.GeoRadius(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: \"dest\"})\n// after\nclient.GeoRadiusStore(ctx, key, lon, lat, &redis.GeoRadiusQuery{Store: \"dest\"})","handlingStrategy":"validation","validationCode":"if query.Store != \"\" || query.StoreDist != \"\" {\n    return client.GeoRadiusStore(ctx, key, lon, lat, query)\n}\nreturn client.GeoRadius(ctx, key, lon, lat, query)","typeGuard":"func isStoreQuery(q *redis.GeoRadiusQuery) bool {\n    return q.Store != \"\" || q.StoreDist != \"\"\n}","tryCatchPattern":"cmd := client.GeoRadius(ctx, key, lon, lat, query)\nif err := cmd.Err(); err != nil && strings.Contains(err.Error(), \"does not support Store\") {\n    return client.GeoRadiusStore(ctx, key, lon, lat, query)\n}","preventionTips":["Pick the method matching intent: GeoRadius (read) vs GeoRadiusStore (write).","Prefer GeoSearchStore on Redis >= 6.2."],"tags":["geo","georadius","validation","deprecated"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}