paperclipai/paperclip · error

Execution workspace was reopened and cannot be archived righ

Error message

Execution workspace was reopened and cannot be archived right now

What it means

archiveWorkspaceUnderLifecycleLock returned the reopen_pending outcome: a concurrent reopen published this workspace as active between the status re-check and the archive write, so this archive request is refused to avoid burying the reopened workspace.

Source

Thrown at server/src/routes/execution-workspaces.ts:1212

      // reopen-pending flag. The lock stops a concurrent reopen from publishing an
      // active row between the status re-check and this archive write, so the
      // destruction fence below never deletes a worktree that a reopen rebuilt.
      const archiveResult = await svc.archiveWorkspaceUnderLifecycleLock({
        id,
        patch,
        closedAt,
      });
      if (!archiveResult) {
        res.status(404).json({ error: "Execution workspace not found" });
        return;
      }
      if (archiveResult.outcome === "reopen_pending") {
        // A reopen published this workspace as active while its source issue is
        // still terminal. A caller will consume the rebuilt worktree. Refuse the
        // archive and return before any lease teardown, runtime-service stop, or
        // artifact cleanup, so the archive control never removes the rebuilt
        // worktree during the reopen consumption window.
        res.status(409).json({
          error: "Execution workspace was reopened and cannot be archived right now",
        });
        return;
      }
      workspace = archiveResult.workspace;
      const capturedGeneration = archiveResult.capturedGeneration;

      // Closing the workspace ends the lane, so the runtime-control lease is released
      // outright rather than waiting for owner-eligibility or TTL recovery.
      await runtimeLeases.release({ executionWorkspaceId: existing.id, force: true });

      if (existing.mode === "shared_workspace") {
        await db
          .update(issues)
          .set({
            executionWorkspaceId: null,
            updatedAt: new Date(),
          })

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. This is an authorization rule, not a bug: perform the action with an actor that satisfies the stated constraint (board user, the owning agent, or an in-scope resource).
  2. If access should be allowed, verify the actor's credentials/company scope and the resource's ownership before retrying.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at server/src/routes/execution-workspaces.ts:780 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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