{"id":"af0583eed1a353c4","repo":"go-redis/redis","slug":"georadiusbymemberstore-requires-store-or-storedist","errorCode":null,"errorMessage":"GeoRadiusByMemberStore requires Store or StoreDist","messagePattern":"GeoRadiusByMemberStore requires Store or StoreDist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"geo_commands.go","lineNumber":89,"sourceCode":"\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}\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.\nfunc (c cmdable) GeoRadiusByMemberStore(\n\tctx context.Context, key, member string, query *GeoRadiusQuery,\n) *IntCmd {\n\targs := geoLocationArgs(query, \"georadiusbymember\", key, member)\n\tcmd := NewIntCmd(ctx, args...)\n\tif query.Store == \"\" && query.StoreDist == \"\" {\n\t\tcmd.SetErr(errors.New(\"GeoRadiusByMemberStore requires Store or StoreDist\"))\n\t\treturn cmd\n\t}\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\nfunc (c cmdable) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd {\n\targs := make([]interface{}, 0, 13)\n\targs = append(args, \"geosearch\", key)\n\targs = geoSearchArgs(q, args)\n\tcmd := NewStringSliceCmd(ctx, args...)\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\nfunc (c cmdable) GeoSearchLocation(\n\tctx context.Context, key string, q *GeoSearchLocationQuery,\n) *GeoSearchLocationCmd {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/geo_commands.go#L71-L107","documentation":"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.","triggerScenarios":"Calling client.GeoRadiusByMemberStore(ctx, key, member, &GeoRadiusQuery{}) with neither Store nor StoreDist.","commonSituations":"Reusing a GeoRadiusQuery zero value, or calling the *Store method while intending a read.","solutions":["Set query.Store or query.StoreDist.","Use client.GeoRadiusByMember(...) if no storage is required."],"exampleFix":"// before\nclient.GeoRadiusByMemberStore(ctx, key, m, &redis.GeoRadiusQuery{})\n// after\nclient.GeoRadiusByMemberStore(ctx, key, m, &redis.GeoRadiusQuery{Store: \"dest\"})","handlingStrategy":"validation","validationCode":"if query.Store == \"\" && query.StoreDist == \"\" {\n    query.Store = \"dest\"\n}\nclient.GeoRadiusByMemberStore(ctx, key, member, query)","typeGuard":"func hasStoreDest(q *redis.GeoRadiusQuery) bool {\n    return q.Store != \"\" || q.StoreDist != \"\"\n}","tryCatchPattern":"cmd := client.GeoRadiusByMemberStore(ctx, key, m, query)\nif err := cmd.Err(); err != nil && strings.Contains(err.Error(), \"requires Store\") {\n    query.Store = \"dest\"\n    cmd = client.GeoRadiusByMemberStore(ctx, key, m, query)\n}","preventionTips":["Set a destination key before calling any *Store method.","Reach for the read method when no storage is intended."],"tags":["geo","georadiusbymember","validation"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}