coleam00/Archon · info

Warning: Reusing existing worktree at ${workingPath}. --base

Error message

Warning: Reusing existing worktree at ${workingPath}. --base ${flagBase} did not change the cut-from (worktree already exists); it still applies to the PR target.

What it means

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.

Source

Thrown at packages/cli/src/commands/workflow.ts:651

      '  --branch/--from/--base act on an isolated git worktree, which folder projects do not use.\n' +
      '  Drop --branch/--from/--base — folder projects always run in place.'
  );
}

/**
 * Warn that `--base` is only HALF applied when an existing worktree is adopted
 * (`--branch` reuse or `--resume`): its cut-from is already fixed, but the
 * override still reaches `$BASE_BRANCH` and retargets the PR.
 *
 * Deliberately not `--from`'s "was not applied" wording — that is accurate for
 * `--from`, which is wholly inert on reuse, and would understate this case.
 */
function warnBaseOverrideOnReuse(workingPath: string, flagBase: string): void {
  getLog().warn(
    { path: workingPath, baseBranch: flagBase },
    'worktree.reuse_base_override_partial'
  );
  console.warn(
    `Warning: Reusing existing worktree at ${workingPath}. ` +
      `--base ${flagBase} did not change the cut-from (worktree already exists); ` +
      'it still applies to the PR target.'
  );
}

/** Error for a worktree-pinned workflow run against a folder project. */
function folderWorktreePolicyError(workflowName: string): Error {
  return new Error(
    `Workflow '${workflowName}' requires a worktree (worktree.enabled: true), ` +
      'which is not available for folder projects (no git repo to isolate).\n' +
      '  Run this workflow against a git-repo project, or change its worktree policy.'
  );
}

/**
 * Error for a failed `--folder` project registration. Distinct from
 * {@link buildRegistrationFailureError} (which mentions worktrees / `--no-worktree`)

View on GitHub (pinned to 0773b97458)

Solutions

  1. 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.
  2. If reuse is intended, ignore the warning: pass --base only to select the PR target branch.
  3. Clean up stale worktrees from prior runs before launching with a new --base value.

Example fix

// before (base ignored for cut-from)
archon workflow run fix-issue --issue 42 --base dev   # reuses old worktree cut from main
// after
git worktree remove /path/to/worktree && git worktree prune
archon workflow run fix-issue --issue 42 --base dev
Defensive patterns

Strategy: validation

Validate before calling

const wt = getWorktreeFor(workingPath);
if (wt && flagBase) {
  console.warn(`--base ${flagBase} will only set the PR target; worktree at ${workingPath} already exists and keeps its cut-from branch.`);
}

Type guard

function worktreeExists(p: string): boolean {
  return fs.existsSync(path.join(p, '.git'));
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/e1a4c0a41cba1695. Report an issue: GitHub.