paperclipai/paperclip · error

Execution workspace "${cwd}" is missing and cannot be restor

Error message

Execution workspace "${cwd}" is missing and cannot be restored because no branch name is recorded.

What it means

The execution workspace directory is missing and the restore path requires rebuilding its git worktree, but the workspace record has no branchName persisted, so there is nothing to recreate the worktree from. The record's branch metadata is incomplete.

Source

Thrown at server/src/services/workspace-runtime.ts:3497

        type: "git_worktree",
        ...(provisionCommand ? { provisionCommand } : {}),
      },
      base: input.base,
      repoRoot,
      worktreePath: realized.worktreePath ?? cwd,
      branchName: realized.branchName ?? "",
      issue: input.issue,
      agent: input.agent,
      created: false,
      recorder: input.recorder ?? null,
    });
    return realized;
  }

  const worktreePath = realized.worktreePath ?? cwd;
  const branchName = asString(input.workspace.branchName, "").trim();
  if (!branchName) {
    throw new Error(`Execution workspace "${cwd}" is missing and cannot be restored because no branch name is recorded.`);
  }

  await fs.mkdir(path.dirname(worktreePath), { recursive: true });
  await runGit(["worktree", "prune"], repoRoot).catch(() => {});
  const restoreBaseRef = input.workspace.baseRef ?? input.base.repoRef ?? null;
  const restoreRefreshWarnings = restoreBaseRef
    ? await refreshRemoteTrackingBaseRef(repoRoot, restoreBaseRef, input.resolveGitAuth)
    : [];
  const restoreCurrentBaseRefSha = restoreBaseRef ? await resolveBaseRefSha(repoRoot, restoreBaseRef) : null;

  let created = false;
  try {
    await recordGitOperation(input.recorder, {
      phase: "worktree_prepare",
      args: ["worktree", "add", worktreePath, branchName],
      cwd: repoRoot,
      metadata: {
        repoRoot,

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. The execution workspace directory is missing and no branch is recorded to rebuild it. Recreate the workspace record with a branch name or restore the directory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/workspace-runtime.ts:3440 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/d0c3cd17f99bee75. Report an issue: GitHub.