coleam00/Archon · warning

Warning: Reusing existing worktree at ${existingEnv.working_

Error message

Warning: Reusing existing worktree at ${existingEnv.working_path}. --from ${options.fromBranch} was not applied (worktree already exists).

What it means

Warning from the run precheck in packages/cli/src/commands/workflow.ts:2612, logged as 'worktree.reuse_from_branch_ignored'. When a run reuses an existing healthy worktree, a `--from <branch>` flag cannot be applied because source selection happens only at worktree creation. The run continues using the existing worktree's source.

Source

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

    configureIsolation(async (repoPath: string) => {
      const repoConfig = await loadRepoConfig(repoPath);
      return repoConfig?.worktree ?? null;
    });

    const provider = getIsolationProvider();

    // Check for existing worktree (only when explicit --branch)
    const existingEnv = options.branchName
      ? await isolationDb.findActiveByWorkflow(codebase.id, 'task', options.branchName)
      : undefined;

    if (existingEnv && (await provider.healthCheck(existingEnv.working_path))) {
      if (options.fromBranch) {
        getLog().warn(
          { path: existingEnv.working_path, fromBranch: options.fromBranch },
          'worktree.reuse_from_branch_ignored'
        );
        console.warn(
          `Warning: Reusing existing worktree at ${existingEnv.working_path}. ` +
            `--from ${options.fromBranch} was not applied (worktree already exists).`
        );
      }
      if (flagBase) {
        warnBaseOverrideOnReuse(existingEnv.working_path, flagBase);
      }
      // Validate base branch before reuse (warning-only — non-blocking)
      try {
        const repoConfig = await loadRepoConfig(codebase.default_cwd);
        const rawBase = repoConfig?.worktree?.baseBranch?.trim();
        // Four-level fallback: --base override → repo config → codebase default →
        // git auto-detect. Mirrors WorktreeProvider and executeWorkflow, so the
        // reuse check validates against the base this dispatch actually asked
        // for instead of reporting a mismatch nobody requested.
        let configuredBase: git.BranchName;
        if (flagBase) {
          configuredBase = git.toBranchName(flagBase);

View on GitHub (pinned to 0773b97458)

Solutions

  1. Complete/remove the existing worktree first (`bun run cli complete <branch> --force`) and re-run with `--from`.
  2. Or drop the `--from` flag if reusing the existing source is acceptable.
  3. Verify which commit the existing worktree is on (`git -C <worktree> log -1`) before continuing.

Example fix

// before: existing worktree wins, --from ignored
archon workflow run fix --from origin/main
// after
bun run cli complete feat/fix --force
archon workflow run fix --from origin/main
Defensive patterns

Strategy: validation

Validate before calling

// Skip --from if an environment already exists for the branch
const existing = await envStore.findByBranch(branch);
if (existing && fromBranch) throw new Error('complete the existing worktree first');

Prevention

When it happens

Trigger: Running `archon workflow run <wf> --from other-branch` when an environment already exists at the working path and passes `provider.healthCheck`; `options.fromBranch` is truthy so the warning is emitted.

Common situations: Re-running a workflow intending to restart from a different source branch, but an old worktree for the same branch name still exists; scripted runs that always pass `--from`.

Related errors


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