coleam00/Archon · error

Cannot determine git remote for ${repoPath}: no 'origin' rem

Error message

Cannot determine git remote for ${repoPath}: no 'origin' remote found and multiple remotes exist (${remoteList}). Set worktree.remote in .archon/config.yaml to specify which remote to use.

What it means

When no explicit remote is configured and getDefaultRemote cannot disambiguate (no 'origin' but multiple remotes exist), resolveRemote refuses to guess which remote to fetch from or push to, listing the candidates and pointing at the `worktree.remote` setting.

Source

Thrown at packages/isolation/src/providers/worktree.ts:903

    try {
      const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote'], { timeout: 10000 });
      remoteNames = stdout
        .split(/\r?\n/)
        .map(remote => remote.trim())
        .filter(remote => remote.length > 0);
    } catch {
      // Best-effort for error message only
    }

    if (remoteNames?.length === 0) {
      throw new Error(
        `Cannot determine git remote for ${repoPath}: no git remote is configured. ` +
          'Add one with `git remote add origin URL`, or use `--no-worktree` to run in the live checkout.'
      );
    }

    const remoteList = remoteNames?.join(', ') ?? '<unknown>';
    throw new Error(
      `Cannot determine git remote for ${repoPath}: no 'origin' remote found and ` +
        `multiple remotes exist (${remoteList}). ` +
        'Set worktree.remote in .archon/config.yaml to specify which remote to use.'
    );
  }

  /**
   * Sync workspace with remote before creating a new worktree
   * Ensures new work starts from the latest code on the base branch.
   *
   * Branch resolution:
   * - If configuredBaseBranch is provided: Uses that branch. Fails with actionable
   *   error if the branch doesn't exist - no silent fallback to default.
   * - If configuredBaseBranch is omitted: Auto-detects the default branch via git.
   *
   * All sync failures are fatal — creating a worktree from an unknown
   * start-point risks branching from the wrong commit.
   *

View on GitHub (pinned to 0773b97458)

Solutions

  1. Set `worktree.remote: <name>` in `.archon/config.yaml` to one of the listed remotes
  2. Rename the primary remote to `origin`: `git remote rename <name> origin` so auto-detection succeeds
  3. Remove unused remotes (`git remote remove <name>`) if only one is actually used
  4. Confirm the chosen remote with `git remote -v` before rerunning

Example fix

# before (.archon/config.yaml)
worktree:
  baseBranch: main
# after
worktree:
  baseBranch: main
  remote: upstream
Defensive patterns

Strategy: validation

Validate before calling

import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const execFileAsync = promisify(execFile);
export async function assertRemoteIsUnambiguous(repoPath: string, configured?: string): Promise<void> {
  if (configured) return;
  const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote']);
  const remotes = stdout.split(/\r?\n/).map(s => s.trim()).filter(Boolean);
  if (remotes.length > 1 && !remotes.includes('origin')) {
    throw new Error(`Set worktree.remote in .archon/config.yaml; remotes: ${remotes.join(', ')}`);
  }
}

Prevention

When it happens

Trigger: WorktreeProvider.create on a repo with several remotes (e.g. 'upstream', 'fork', 'deploy') where none is named 'origin', and `worktree.remote` is not set in `.archon/config.yaml`.

Common situations: Open-source contributors with `upstream` + their fork remotes; repos migrated off an 'origin' naming convention; teams where remotes are named after environments.

Related errors


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