{"record":{"id":"1e7ffa725082a622","repo":"t8y2/dbx","slug":"etcd-lease-list-timeout","errorCode":"ETCD_LEASE_LIST_TIMEOUT","errorMessage":"ETCD_LEASE_LIST_TIMEOUT","messagePattern":"ETCD_LEASE_LIST_TIMEOUT","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agents/drivers/etcd-go/lease.go","lineNumber":33,"sourceCode":"\t\"google.golang.org/grpc/status\"\n)\n\nconst (\n\tmaxLeaseAttachedKeys     = 256\n\tdefaultLeaseListLimit    = 100\n\tmaxLeaseListLimit        = 200\n\tleaseListConcurrency     = 8\n\tleaseListDeadlineSeconds = 5\n)\n\ntype leaseListDeadline struct {\n\tdeadline time.Time\n}\n\nfunc (d leaseListDeadline) remaining() (time.Duration, error) {\n\tremaining := time.Until(d.deadline)\n\tif remaining <= 0 {\n\t\treturn 0, errors.New(\"ETCD_LEASE_LIST_TIMEOUT\")\n\t}\n\treturn remaining, nil\n}\n\nfunc (s *etcdSession) leaseList(params map[string]json.RawMessage) (any, error) {\n\tclient, err := s.activeClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdeadline := leaseListDeadline{deadline: time.Now().Add(leaseListDeadlineSeconds * time.Second)}\n\tlimit := intOrDefault(params, \"limit\", defaultLeaseListLimit)\n\tif limit < 1 {\n\t\tlimit = 1\n\t}\n\tif limit > maxLeaseListLimit {\n\t\tlimit = maxLeaseListLimit\n\t}\n\tcontinuation := stringOrNull(params, \"continuation\")","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/etcd-go/lease.go#L15-L51","documentation":"leaseList paginates leases under a deadline represented by leaseListDeadline. Before each page fetch, remaining() checks time.Until(deadline); if the deadline has already passed (remaining <= 0), it aborts with ETCD_LEASE_LIST_TIMEOUT. The operation is a best-effort listing, so hitting the deadline yields a partial result rather than blocking indefinitely.","triggerScenarios":"Calling leaseList on a cluster with many leases or slow endpoints such that time.Until(d.deadline) <= 0 before/during paging, i.e. the configured lease-list deadline elapsed at lease.go:33.","commonSituations":"Very large clusters (thousands of active leases) where paging exceeds the timeout; slow or loaded etcd endpoints; a client clock vs server clock mismatch making the deadline appear already expired; setting the per-operation timeout too low in the environment.","solutions":["Increase the lease-list deadline/timeout used by beginOperation or the leaseList call configuration.","Use the returned continuation token to fetch the remaining leases in a follow-up call instead of one pass.","Reduce lease churn / total lease count (revoke expired leases) so the listing completes in time.","Check network latency to etcd endpoints and target a healthier endpoint."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := agent.call(\"lease_list\", params)\nif err != nil && strings.Contains(err.Error(), \"ETCD_LEASE_LIST_TIMEOUT\") {\n    // retry with a longer deadline or page via continuation\n    return agent.call(\"lease_list\", map[string]any{\"continuation\": lastTok})\n}","preventionTips":["Budget the lease-list deadline relative to expected lease count.","Use pagination (continuation) instead of expecting one full pass.","Revoke expired leases regularly to keep the list small."],"tags":["etcd","timeout","lease","pagination"],"backgroundTag":"operation-timeout","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}