{"record":{"id":"967854e2370fd204","repo":"ruvnet/ruflo","slug":"expired-fence","errorCode":"expired-fence","errorMessage":"lease ${presented.leaseId} expired","messagePattern":"lease (.+?) expired","errorType":"exception","errorClass":"InMemoryFenceReferenceError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts","lineNumber":143,"sourceCode":"      epoch: epoch.toString(),\n      version: '1',\n      issuedAt: new Date(now).toISOString(),\n      expiresAt: new Date(expiresAtMs).toISOString(),\n      advisory: true,\n    };\n    this.leases.set(lease.leaseId, { lease, expiresAtMs });\n    return copyLease(lease);\n  }\n\n  renew(presented: FencedLease, ttlMs: number): FencedLease {\n    if (!Number.isSafeInteger(ttlMs) || ttlMs <= 0) {\n      throw new InMemoryFenceReferenceError('invalid-request', 'renewal requires a positive safe ttlMs');\n    }\n    const stored = this.assertStoredFence(presented);\n    const now = this.now();\n    if (stored.expiresAtMs <= now) {\n      this.leases.delete(presented.leaseId);\n      throw new InMemoryFenceReferenceError('expired-fence', `lease ${presented.leaseId} expired`);\n    }\n    const expiresAtMs = now + ttlMs;\n    if (!Number.isSafeInteger(expiresAtMs)) {\n      throw new InMemoryFenceReferenceError('invalid-request', 'lease expiry exceeds safe timestamp range');\n    }\n    const lease: FencedLease = {\n      ...stored.lease,\n      version: (parseCanonicalUnsigned(stored.lease.version, 'lease version') + 1n).toString(),\n      expiresAt: new Date(expiresAtMs).toISOString(),\n      scopes: [...stored.lease.scopes],\n    };\n    this.leases.set(lease.leaseId, { lease, expiresAtMs });\n    return copyLease(lease);\n  }\n\n  release(presented: FencedLease): void {\n    this.assertCurrentFence(presented);\n    this.leases.delete(presented.leaseId);","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts#L125-L161","documentation":"Thrown when an operation presents a lease whose expiry has passed. Defense: track lease expiry client-side, renew the lease before it expires, and treat expiry as a signal to re-acquire rather than retry the fenced operation.","triggerScenarios":"Thrown at v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts:143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-acquire the lease before presenting it; an expired leaseId cannot be renewed in place.","Shorten the operation or request a longer TTL at acquire time so the lease stays valid for the whole critical section.","Send heartbeats during long operations so the lease does not lapse while work is in progress."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}