{"record":{"id":"76bdb9912c235fd9","repo":"redis/go-redis","slug":"redis-function-list-unexpected-key-s","errorCode":null,"errorMessage":"redis: function list unexpected key %s","messagePattern":"redis: function list unexpected key (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command.go","lineNumber":6772,"sourceCode":"\n\t\tlibrary := Library{}\n\t\tfor f := 0; f < nn; f++ {\n\t\t\tkey, err := rd.ReadString()\n\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 \"library_name\":\n\t\t\t\tlibrary.Name, err = rd.ReadString()\n\t\t\tcase \"engine\":\n\t\t\t\tlibrary.Engine, err = rd.ReadString()\n\t\t\tcase \"functions\":\n\t\t\t\tlibrary.Functions, err = cmd.readFunctions(rd)\n\t\t\tcase \"library_code\":\n\t\t\t\tlibrary.Code, err = rd.ReadString()\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"redis: function list unexpected key %s\", 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\n\t\tlibraries[i] = library\n\t}\n\tcmd.val = libraries\n\treturn nil\n}\n\nfunc (cmd *FunctionListCmd) readFunctions(rd *proto.Reader) ([]Function, error) {\n\tn, err := rd.ReadArrayLen()\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":6754,"sourceCodeEnd":6790,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/command.go#L6754-L6790","documentation":"Thrown by the FUNCTION LIST reply parser when it encounters a map key other than the documented `library_name`, `engine`, `functions`, or `library_code` (command.go, FunctionList readReply). Redis added a new field to the FUNCTION LIST reply that this client version doesn't know, or a compatible server emits extra keys.","triggerScenarios":"Calling `client.FunctionList(ctx, pattern, withCode)` against a Redis server (often 7.x/8.x or Redis Enterprise) whose FUNCTION LIST reply contains a key this go-redis version doesn't recognize — e.g. a newly added metadata field.","commonSituations":"Upgrading the Redis server ahead of the client library; Redis Enterprise forks adding extra reply fields; running a nightly/preview Redis build with new function metadata.","solutions":["Upgrade go-redis to the latest v9 release, which recognizes newer FUNCTION LIST fields.","Check the error's key name and compare with `redis-cli --raw FUNCTION LIST` output on your server to identify the new field.","As a stopgap, downgrade the server or avoid FUNCTION LIST against that server version.","If the key comes from a proxy/Enterprise fork, file an issue with go-redis including the raw reply."],"exampleFix":"// before: server upgraded to a Redis version with new FUNCTION LIST fields, old client\ngo get github.com/redis/go-redis/v9@latest\n\n// after: client parser knows the new keys\nrequire github.com/redis/go-redis/v9 v9.x.y // latest","handlingStrategy":"try-catch","validationCode":"// check Redis version supports the FUNCTION LIST format this client parses\nver := redisVersion(rdb) // from INFO server\nif ver == nil || ver.LessThan(semver.MustParse(\"7.0.0\")) {\n    return nil, errors.New(\"function list unsupported\")\n}","typeGuard":null,"tryCatchPattern":"libs, err := rdb.FunctionList(ctx, \"*\", true)\nif err != nil {\n    if strings.Contains(err.Error(), \"function list unexpected key\") {\n        // server adds unknown fields: upgrade go-redis or treat as unsupported\n        return nil, fmt.Errorf(\"FUNCTION LIST format unsupported by client: %w\", err)\n    }\n    return err\n}","preventionTips":["Always upgrade go-redis in the same change that upgrades the Redis server.","Pin supported server versions; avoid nightly/preview builds in production.","Run a FUNCTION LIST integration test in CI against your server version.","Check release notes for reply-parser changes when upgrading either side."],"tags":["redis","function-list","protocol-parse","version-drift"],"backgroundTag":"unexpected-reply-shape","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}