paperclipai/paperclip · error

Daytona sandbox lease

Error message

Daytona sandbox lease ${scope.providerLeaseId} is no longer active.

What it means

Admission gate failure in withSandboxActivityGate: the sandbox lease admission tracker has marked this scope (providerLeaseId) as closed — a concurrent release/destroy already tore the lease down — and the current operation does not run with allowClosed. Subsequent activity on the dead lease is rejected instead of racing teardown.

Solutions

  1. Acquire a new sandbox lease; the previous lease has ended.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/plugins/sandbox-providers/daytona/src/plugin.ts:1136 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-08-18). Data as JSON: /api/errors/389baf2bdc9a1797. Report an issue: GitHub.

Appendix: source

Thrown at packages/plugins/sandbox-providers/daytona/src/plugin.ts:1189

  function open(scope: SandboxScope): void {
    states.set(key(scope), false);
  }

  function close(scope: SandboxScope): void {
    states.set(key(scope), true);
  }

  function isClosed(scope: SandboxScope): boolean {
    return states.get(key(scope)) === true;
  }

  function reset(): void {
    states.clear();
  }

  return { open, close, isClosed, reset };
})();

async function withSandboxActivityGate<T>(
  scope: SandboxScope,
  fn: () => Promise<T>,
  options: SandboxLeaseAdmissionOptions = {},
): Promise<T> {
  while (true) {
    if (!options.allowClosed && sandboxHandleLeaseAdmissionStates.isClosed(scope)) {
      throw new Error(`Daytona sandbox lease ${scope.providerLeaseId} is no longer active.`);
    }

    const teardownGate = sandboxHandleTeardownGates.current(scope);
    if (teardownGate) {
      await teardownGate.promise;
      if (!options.allowClosed && sandboxHandleLeaseAdmissionStates.isClosed(scope)) {
        throw new Error(`Daytona sandbox lease ${scope.providerLeaseId} is no longer active.`);
      }
      continue;

View on GitHub (pinned to 3f1d897a7c)