paperclipai/paperclip · error
No acquireLease event found for environment ${environmentId}
Error message
No acquireLease event found for environment ${environmentId} What it means
Test-helper assertion in assertLeaseLifecycle: no event of type 'acquireLease' was recorded for the given environmentId. The helper's contract requires a full acquire-then-release lifecycle in the EnvironmentEventRecord stream, so a missing acquire means the plugin under test never (successfully) acquired a lease for that environment.
Source
Thrown at packages/plugins/sdk/src/testing.ts:272
matched.push(eventType);
cursor++;
}
}
if (matched.length !== expectedOrder.length) {
throw new Error(
`Environment event order mismatch.\nExpected: ${JSON.stringify(expectedOrder)}\nActual: ${JSON.stringify(actual)}`,
);
}
}
/** Assert that a full lease lifecycle (acquire → release) occurred for an environment. */
export function assertLeaseLifecycle(
events: EnvironmentEventRecord[],
environmentId: string,
): { acquire: EnvironmentEventRecord; release: EnvironmentEventRecord } {
const acquire = events.find((e) => e.type === "acquireLease" && e.environmentId === environmentId);
const release = events.find((e) => (e.type === "releaseLease" || e.type === "destroyLease") && e.environmentId === environmentId);
if (!acquire) throw new Error(`No acquireLease event found for environment ${environmentId}`);
if (!release) throw new Error(`No releaseLease/destroyLease event found for environment ${environmentId}`);
if (acquire.timestamp > release.timestamp) {
throw new Error(`acquireLease occurred after release for environment ${environmentId}`);
}
return { acquire, release };
}
/** Assert that workspace realization occurred between lease acquire and release. */
export function assertWorkspaceRealizationLifecycle(
events: EnvironmentEventRecord[],
environmentId: string,
): EnvironmentEventRecord {
const lifecycle = assertLeaseLifecycle(events, environmentId);
const realize = events.find(
(e) => e.type === "realizeWorkspace" && e.environmentId === environmentId,
);
if (!realize) throw new Error(`No realizeWorkspace event found for environment ${environmentId}`);
if (realize.timestamp < lifecycle.acquire.timestamp) {View on GitHub (pinned to 01ad858492)
Solutions
- Ensure the environment acquires a lease before other lifecycle events.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/plugins/sdk/src/testing.ts:272 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/22907cd9893a93f7.
Report an issue: GitHub.