{"record":{"id":"e71cc04ea3742a2b","repo":"coleam00/Archon","slug":"cannot-determine-git-remote-for-repopath-no-o","errorCode":null,"errorMessage":"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.","messagePattern":"Cannot determine git remote for (.+?): no 'origin' remote found and multiple remotes exist \\((.+?)\\)\\. Set worktree\\.remote in \\.archon/config\\.yaml to specify which remote to use\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/isolation/src/providers/worktree.ts","lineNumber":903,"sourceCode":"    try {\n      const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote'], { timeout: 10000 });\n      remoteNames = stdout\n        .split(/\\r?\\n/)\n        .map(remote => remote.trim())\n        .filter(remote => remote.length > 0);\n    } catch {\n      // Best-effort for error message only\n    }\n\n    if (remoteNames?.length === 0) {\n      throw new Error(\n        `Cannot determine git remote for ${repoPath}: no git remote is configured. ` +\n          'Add one with `git remote add origin URL`, or use `--no-worktree` to run in the live checkout.'\n      );\n    }\n\n    const remoteList = remoteNames?.join(', ') ?? '<unknown>';\n    throw new Error(\n      `Cannot determine git remote for ${repoPath}: no 'origin' remote found and ` +\n        `multiple remotes exist (${remoteList}). ` +\n        'Set worktree.remote in .archon/config.yaml to specify which remote to use.'\n    );\n  }\n\n  /**\n   * Sync workspace with remote before creating a new worktree\n   * Ensures new work starts from the latest code on the base branch.\n   *\n   * Branch resolution:\n   * - If configuredBaseBranch is provided: Uses that branch. Fails with actionable\n   *   error if the branch doesn't exist - no silent fallback to default.\n   * - If configuredBaseBranch is omitted: Auto-detects the default branch via git.\n   *\n   * All sync failures are fatal — creating a worktree from an unknown\n   * start-point risks branching from the wrong commit.\n   *","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/isolation/src/providers/worktree.ts#L885-L921","documentation":"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.","triggerScenarios":"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`.","commonSituations":"Open-source contributors with `upstream` + their fork remotes; repos migrated off an 'origin' naming convention; teams where remotes are named after environments.","solutions":["Set `worktree.remote: <name>` in `.archon/config.yaml` to one of the listed remotes","Rename the primary remote to `origin`: `git remote rename <name> origin` so auto-detection succeeds","Remove unused remotes (`git remote remove <name>`) if only one is actually used","Confirm the chosen remote with `git remote -v` before rerunning"],"exampleFix":"# before (.archon/config.yaml)\nworktree:\n  baseBranch: main\n# after\nworktree:\n  baseBranch: main\n  remote: upstream","handlingStrategy":"validation","validationCode":"import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst execFileAsync = promisify(execFile);\nexport async function assertRemoteIsUnambiguous(repoPath: string, configured?: string): Promise<void> {\n  if (configured) return;\n  const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote']);\n  const remotes = stdout.split(/\\r?\\n/).map(s => s.trim()).filter(Boolean);\n  if (remotes.length > 1 && !remotes.includes('origin')) {\n    throw new Error(`Set worktree.remote in .archon/config.yaml; remotes: ${remotes.join(', ')}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name the primary remote `origin` wherever you control the clone","Always set `worktree.remote` in multi-remote setups (fork/upstream workflows)","Audit remotes with `git remote -v` during project setup","Document the chosen remote in the repo's `.archon/config.yaml`"],"tags":["git","remote","ambiguity","configuration"],"backgroundTag":"ambiguous-git-remote","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}