earendil-works/pi · error · PiSessionOwnershipError
Session ${sessionId} has an exclusive lease
Error message
Session ${sessionId} has an exclusive lease What it means
Error "Session ${sessionId} has an exclusive lease" thrown in earendil-works/pi.
Source
Thrown at packages/client/src/client.ts:387
.then(() => {
this.#sessionCleanupRequired.delete(sessionId);
})
.finally(() => {
this.#sessionReconciliations.delete(sessionId);
});
this.#sessionReconciliations.set(sessionId, reconciliation);
}
await reconciliation;
return true;
}
#reserveSessionLease(sessionId: string, mode: SessionLeaseMode): SessionLeaseToken {
const count = this.#sessionLeaseCounts.get(sessionId) ?? 0;
if (mode === "exclusive" && count > 0) {
throw new PiSessionOwnershipError(sessionId, `Session ${sessionId} already has an active lease`);
}
if (mode === "shared" && this.#exclusiveSessionLeases.has(sessionId)) {
throw new PiSessionOwnershipError(sessionId, `Session ${sessionId} has an exclusive lease`);
}
const token: SessionLeaseToken = { mode };
this.#sessionLeaseCounts.set(sessionId, count + 1);
if (mode === "exclusive") this.#exclusiveSessionLeases.set(sessionId, token);
return token;
}
#releaseSessionLease(sessionId: string, token: SessionLeaseToken): void {
const count = this.#sessionLeaseCounts.get(sessionId) ?? 0;
if (count <= 1) this.#sessionLeaseCounts.delete(sessionId);
else this.#sessionLeaseCounts.set(sessionId, count - 1);
if (this.#exclusiveSessionLeases.get(sessionId) === token) this.#exclusiveSessionLeases.delete(sessionId);
}
#invalidateSessionLeases(sessionId: string): void {
this.#sessionLeaseCounts.delete(sessionId);
this.#exclusiveSessionLeases.delete(sessionId);
this.#sessionCleanupRequired.delete(sessionId);View on GitHub (pinned to 4af9d21d3b)
Solutions
- Wait for the exclusive lease to be released, or release it before attaching.
When it happens
Trigger: Thrown at packages/client/src/client.ts:387 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/918955a889f54c88.
Report an issue: GitHub.