{"record":{"id":"e1a4c0a41cba1695","repo":"coleam00/Archon","slug":"warning-reusing-existing-worktree-at-workingpat","errorCode":null,"errorMessage":"Warning: Reusing existing worktree at ${workingPath}. --base ${flagBase} did not change the cut-from (worktree already exists); it still applies to the PR target.","messagePattern":"Warning: Reusing existing worktree at (.+?)\\. --base (.+?) did not change the cut-from \\(worktree already exists\\); it still applies to the PR target\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":651,"sourceCode":"      '  --branch/--from/--base act on an isolated git worktree, which folder projects do not use.\\n' +\n      '  Drop --branch/--from/--base — folder projects always run in place.'\n  );\n}\n\n/**\n * Warn that `--base` is only HALF applied when an existing worktree is adopted\n * (`--branch` reuse or `--resume`): its cut-from is already fixed, but the\n * override still reaches `$BASE_BRANCH` and retargets the PR.\n *\n * Deliberately not `--from`'s \"was not applied\" wording — that is accurate for\n * `--from`, which is wholly inert on reuse, and would understate this case.\n */\nfunction warnBaseOverrideOnReuse(workingPath: string, flagBase: string): void {\n  getLog().warn(\n    { path: workingPath, baseBranch: flagBase },\n    'worktree.reuse_base_override_partial'\n  );\n  console.warn(\n    `Warning: Reusing existing worktree at ${workingPath}. ` +\n      `--base ${flagBase} did not change the cut-from (worktree already exists); ` +\n      'it still applies to the PR target.'\n  );\n}\n\n/** Error for a worktree-pinned workflow run against a folder project. */\nfunction folderWorktreePolicyError(workflowName: string): Error {\n  return new Error(\n    `Workflow '${workflowName}' requires a worktree (worktree.enabled: true), ` +\n      'which is not available for folder projects (no git repo to isolate).\\n' +\n      '  Run this workflow against a git-repo project, or change its worktree policy.'\n  );\n}\n\n/**\n * Error for a failed `--folder` project registration. Distinct from\n * {@link buildRegistrationFailureError} (which mentions worktrees / `--no-worktree`)","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L633-L669","documentation":"A warning printed when a workflow run reuses an existing git worktree instead of cutting a new one, while a --base flag was supplied. Because the worktree already exists, --base cannot change what it was cut from; the flag still applies only to the PR target branch. The event is logged as worktree.reuse_base_override_partial.","triggerScenarios":"Running a workflow (via runWorkflowWithOwnedSource) with --base <branch> when the computed working path already contains an existing worktree — e.g. re-running the same workflow for the same issue without cleaning up the previous worktree.","commonSituations":"Re-running a workflow after a previous run left its worktree in place; iterating on issue #N expecting --base to rebase the workspace onto a different branch; switching base branches between runs of the same workflow.","solutions":["Remove the existing worktree (`git worktree remove <path>` or delete it and prune) if you want --base to control the cut-from branch, then re-run.","If reuse is intended, ignore the warning: pass --base only to select the PR target branch.","Clean up stale worktrees from prior runs before launching with a new --base value."],"exampleFix":"// before (base ignored for cut-from)\narchon workflow run fix-issue --issue 42 --base dev   # reuses old worktree cut from main\n// after\ngit worktree remove /path/to/worktree && git worktree prune\narchon workflow run fix-issue --issue 42 --base dev","handlingStrategy":"validation","validationCode":"const wt = getWorktreeFor(workingPath);\nif (wt && flagBase) {\n  console.warn(`--base ${flagBase} will only set the PR target; worktree at ${workingPath} already exists and keeps its cut-from branch.`);\n}","typeGuard":"function worktreeExists(p: string): boolean {\n  return fs.existsSync(path.join(p, '.git'));\n}","tryCatchPattern":null,"preventionTips":["Remove or prune stale worktrees before re-running a workflow with a new --base.","Remember --base on reuse only affects the PR target, never the cut-from branch.","Check `git worktree list` before launching workflows that cut worktrees.","Treat this warning as expected when intentionally reusing a workspace."],"tags":["worktree","git","cli-flag"],"backgroundTag":"worktree-reuse-flag-partially-applied","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}