{"record":{"id":"e87cb11803cd2cb1","repo":"Tencent/WeKnora","slug":"redis-client-is-required","errorCode":null,"errorMessage":"redis client is required","messagePattern":"redis client is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/common/redislock/token_lock.go","lineNumber":115,"sourceCode":"\t\tcase <-ctx.Done():\n\t\t\tif !timer.Stop() {\n\t\t\t\t<-timer.C\n\t\t\t}\n\t\t\treturn ctx.Err()\n\t\tcase <-timer.C:\n\t\t}\n\t}\n}\n\n// Release deletes the lock only if token still owns it.\nfunc Release(\n\tctx context.Context,\n\tclient redis.UniversalClient,\n\tkey string,\n\ttoken string,\n) (bool, error) {\n\tif client == nil {\n\t\treturn false, errors.New(\"redis client is required\")\n\t}\n\tif key == \"\" || token == \"\" {\n\t\treturn false, errors.New(\"redis lock key and token are required\")\n\t}\n\treleased, err := releaseScript.Run(ctx, client, []string{key}, token).Int64()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"release redis lock %q: %w\", key, err)\n\t}\n\treturn released != 0, nil\n}\n\n// Renew extends the lease only if token still owns the lock.\nfunc Renew(\n\tctx context.Context,\n\tclient redis.UniversalClient,\n\tkey string,\n\ttoken string,\n\tlease time.Duration,","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/common/redislock/token_lock.go#L97-L133","documentation":"Argument guard raised by redislock.Release when the client parameter is nil — Release was called without a usable Redis client, so the release script cannot run. Programming/initialization error rather than a runtime Redis failure.","triggerScenarios":"Thrown at internal/common/redislock/token_lock.go:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Initialize and pass the Redis UniversalClient before calling Release","Fix the DI/initialization order so the lock helper receives the client"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}