{"id":"a46363328b1f1373","repo":"go-redis/redis","slug":"redis-unexpected-key-q-in-cluster-links-reply","errorCode":null,"errorMessage":"redis: unexpected key %q in CLUSTER LINKS reply","messagePattern":"redis: unexpected key %q in CLUSTER LINKS reply","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command.go","lineNumber":7515,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tswitch key {\n\t\t\tcase \"direction\":\n\t\t\t\tcmd.val[i].Direction, err = rd.ReadString()\n\t\t\tcase \"node\":\n\t\t\t\tcmd.val[i].Node, err = rd.ReadString()\n\t\t\tcase \"create-time\":\n\t\t\t\tcmd.val[i].CreateTime, err = rd.ReadInt()\n\t\t\tcase \"events\":\n\t\t\t\tcmd.val[i].Events, err = rd.ReadString()\n\t\t\tcase \"send-buffer-allocated\":\n\t\t\t\tcmd.val[i].SendBufferAllocated, err = rd.ReadInt()\n\t\t\tcase \"send-buffer-used\":\n\t\t\t\tcmd.val[i].SendBufferUsed, err = rd.ReadInt()\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"redis: unexpected key %q in CLUSTER LINKS reply\", key)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (cmd *ClusterLinksCmd) Clone() Cmder {\n\tvar val []ClusterLink\n\tif cmd.val != nil {\n\t\tval = make([]ClusterLink, len(cmd.val))\n\t\tcopy(val, cmd.val)\n\t}\n\treturn &ClusterLinksCmd{","sourceCodeStart":7497,"sourceCodeEnd":7533,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/command.go#L7497-L7533","documentation":"Thrown by ClusterLinksCmd.readReply (command.go:7515) while parsing CLUSTER LINKS. Each link map may only contain direction/node/create-time/events/send-buffer-allocated/send-buffer-used; any other key aborts to keep the map aligned.","triggerScenarios":"client.ClusterLinks(ctx) against a Redis that added a new per-link field the linked go-redis does not recognize (forward-compat drift), or a fork with extra fields.","commonSituations":"Newer Redis (>= some 7.x/8.x point release) adding a CLUSTER LINKS field; older go-redis against a newer server; Redis fork.","solutions":["Upgrade go-redis to a release that recognizes the new CLUSTER LINKS key.","Pin Redis to a version whose CLUSTER LINKS output matches.","Inspect `redis-cli CLUSTER LINKS` to identify the new key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// redis-cli CLUSTER LINKS  -> confirm only known link keys are emitted by your Redis version.","typeGuard":null,"tryCatchPattern":"links, err := client.ClusterLinks(ctx).Result()\nif err != nil {\n    // forward-compat drift; upgrade go-redis; degrade to empty slice\n    links = nil\n}","preventionTips":["Upgrade go-redis before upgrading Redis if CLUSTER LINKS shape changed.","Treat ClusterLinks output as informational."],"tags":["cluster","cluster-links","resp-parsing","version-mismatch"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}