ruvnet/ruflo · error · InMemoryFenceReferenceError

unknown-lease

unknown-lease

Error message

unknown lease ${presented.leaseId}

What it means

Thrown when an operation references a leaseId that the registry does not know. Defense: persist the leaseId returned by acquire and never fabricate one; after a restart, re-acquire instead of reusing stale in-memory identifiers.

Source

Thrown at v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts:183

    const stored = this.assertStoredFence(presented);
    if (stored.expiresAtMs <= this.now()) {
      this.leases.delete(presented.leaseId);
      throw new InMemoryFenceReferenceError('expired-fence', `lease ${presented.leaseId} expired`);
    }
  }

  current(repositoryId?: string): FencedLease[] {
    this.pruneExpired(this.now());
    return [...this.leases.values()]
      .map(({ lease }) => lease)
      .filter((lease) => repositoryId === undefined || lease.repositoryId === repositoryId)
      .sort((left, right) => compare(left.leaseId, right.leaseId))
      .map(copyLease);
  }

  private assertStoredFence(presented: FencedLease): StoredLease {
    const stored = this.leases.get(presented.leaseId);
    if (!stored) throw new InMemoryFenceReferenceError('unknown-lease', `unknown lease ${presented.leaseId}`);
    const current = stored.lease;
    if (
      current.repositoryId !== presented.repositoryId
      || current.sessionId !== presented.sessionId
      || current.workloadId !== presented.workloadId
      || current.worktreeId !== presented.worktreeId
      || current.kind !== presented.kind
      || !sameStrings(current.scopes, presented.scopes)
      || current.epoch !== presented.epoch
      || current.version !== presented.version
    ) {
      throw new InMemoryFenceReferenceError('stale-fence', `stale or altered fence ${presented.leaseId}`);
    }
    return stored;
  }

  private pruneExpired(now: number): void {
    for (const [leaseId, stored] of this.leases) {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Acquire the lease first and use the leaseId returned by acquire, not a fabricated or stale id.
  2. Check that the lease was not already released or expired before presenting it.
  3. Verify you are talking to the same lease manager instance that issued the lease.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts:183 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/165c79e10f0b0935. Report an issue: GitHub.