{"record":{"id":"d0c3cd17f99bee75","repo":"paperclipai/paperclip","slug":"execution-workspace-cwd-is-missing-and-cannot","errorCode":null,"errorMessage":"Execution workspace \"${cwd}\" is missing and cannot be restored because no branch name is recorded.","messagePattern":"Execution workspace \"(.+?)\" is missing and cannot be restored because no branch name is recorded\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/workspace-runtime.ts","lineNumber":3497,"sourceCode":"        type: \"git_worktree\",\n        ...(provisionCommand ? { provisionCommand } : {}),\n      },\n      base: input.base,\n      repoRoot,\n      worktreePath: realized.worktreePath ?? cwd,\n      branchName: realized.branchName ?? \"\",\n      issue: input.issue,\n      agent: input.agent,\n      created: false,\n      recorder: input.recorder ?? null,\n    });\n    return realized;\n  }\n\n  const worktreePath = realized.worktreePath ?? cwd;\n  const branchName = asString(input.workspace.branchName, \"\").trim();\n  if (!branchName) {\n    throw new Error(`Execution workspace \"${cwd}\" is missing and cannot be restored because no branch name is recorded.`);\n  }\n\n  await fs.mkdir(path.dirname(worktreePath), { recursive: true });\n  await runGit([\"worktree\", \"prune\"], repoRoot).catch(() => {});\n  const restoreBaseRef = input.workspace.baseRef ?? input.base.repoRef ?? null;\n  const restoreRefreshWarnings = restoreBaseRef\n    ? await refreshRemoteTrackingBaseRef(repoRoot, restoreBaseRef, input.resolveGitAuth)\n    : [];\n  const restoreCurrentBaseRefSha = restoreBaseRef ? await resolveBaseRefSha(repoRoot, restoreBaseRef) : null;\n\n  let created = false;\n  try {\n    await recordGitOperation(input.recorder, {\n      phase: \"worktree_prepare\",\n      args: [\"worktree\", \"add\", worktreePath, branchName],\n      cwd: repoRoot,\n      metadata: {\n        repoRoot,","sourceCodeStart":3479,"sourceCodeEnd":3515,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/workspace-runtime.ts#L3479-L3515","documentation":"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.","triggerScenarios":"Thrown at server/src/services/workspace-runtime.ts:3440 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}