ruvnet/ruflo · error · InMemoryFenceReferenceError

scope-conflict

scope-conflict

Error message

scope conflicts with active lease ${current.leaseId}

What it means

Thrown when acquiring a lease whose scope overlaps an already-active lease. Defense: check for existing active leases on the same scope before acquiring; release or wait for the conflicting lease to expire, and retry with the current fencing epoch.

Solutions

  1. Release or wait out the active lease that covers the requested scope before acquiring again.
  2. Acquire the lease with a scope that does not overlap the scope of the conflicting lease.
  3. List active leases and renew the existing one instead of requesting a new lease for the same scope.

When it happens

Trigger: Thrown at v3/@claude-flow/codex/src/harness/in-memory-fenced-lease-reference.ts:104 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/feb236519c55ed83. Report an issue: GitHub.

Appendix: source

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

  private readonly leases = new Map<string, StoredLease>();
  private readonly repositoryEpoch = new Map<string, bigint>();

  constructor(private readonly now: () => number = Date.now) {}

  acquire(request: FencedLeaseRequest): FencedLease {
    const repositoryId = text(request.repositoryId, 'repositoryId');
    const scopes = [...new Set(request.scopes.map((scope) => normalizeScope(request.kind, scope)))]
      .sort(compare);
    if (!scopes.length || !Number.isSafeInteger(request.ttlMs) || request.ttlMs <= 0) {
      throw new InMemoryFenceReferenceError('invalid-request', 'lease requires scopes and a positive safe ttlMs');
    }
    const now = this.now();
    this.pruneExpired(now);
    for (const stored of this.leases.values()) {
      const current = stored.lease;
      if (current.repositoryId !== repositoryId || current.kind !== request.kind) continue;
      if (current.scopes.some((held) => scopes.some((wanted) => overlaps(request.kind, held, wanted)))) {
        throw new InMemoryFenceReferenceError(
          'scope-conflict',
          `scope conflicts with active lease ${current.leaseId}`,
        );
      }
    }

    const epoch = (this.repositoryEpoch.get(repositoryId) ?? 0n) + 1n;
    this.repositoryEpoch.set(repositoryId, epoch);
    const expiresAtMs = now + request.ttlMs;
    if (!Number.isSafeInteger(expiresAtMs)) {
      throw new InMemoryFenceReferenceError('invalid-request', 'lease expiry exceeds safe timestamp range');
    }
    const lease: FencedLease = {
      leaseId: `lease-${randomUUID()}`,
      repositoryId,
      sessionId: text(request.sessionId, 'sessionId'),
      workloadId: text(request.workloadId, 'workloadId'),
      worktreeId: text(request.worktreeId, 'worktreeId'),

View on GitHub (pinned to fa13ee4ad6)