{"record":{"id":"431cfd867eaf95d2","repo":"coleam00/Archon","slug":"failed-to-fetch-base-branch-from-remote-er","errorCode":null,"errorMessage":"Failed to fetch base branch from '${remote}': ${err.message}. Check your network connection and remote configuration.","messagePattern":"Failed to fetch base branch from '(.+?)': (.+?)\\. Check your network connection and remote configuration\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/isolation/src/providers/worktree.ts","lineNumber":970,"sourceCode":"      const errorMessage = err.message.toLowerCase();\n\n      // Fatal errors - throw to prevent confusing downstream failures\n      if (err.code === 'EACCES' || errorMessage.includes('permission denied')) {\n        throw new Error(\n          `Permission denied accessing repository at ${repoPath}. ` +\n            'Check file permissions and try again.'\n        );\n      } else if (errorMessage.includes('not a git repository')) {\n        throw new Error(\n          `${repoPath} is not a valid git repository. ` +\n            'Ensure the workspace was cloned correctly.'\n        );\n      } else if (errorMessage.includes('configured base branch')) {\n        // Configured branch errors are fatal - user needs to fix their config\n        throw err;\n      } else {\n        // Network errors, timeouts — cannot guarantee correct start-point\n        throw new Error(\n          `Failed to fetch base branch from '${remote}': ${err.message}. ` +\n            'Check your network connection and remote configuration.'\n        );\n      }\n    }\n  }\n\n  /**\n   * Copy git-ignored files to worktree based on repo config.\n   * Returns `configLoadFailed: true` when no config was provided and the\n   * internal fallback load of the config fails — so the caller can surface\n   * a warning without blocking worktree creation.\n   *\n   * `.archon` used to be copied unconditionally, because it was the only way a\n   * workflow's own commands and scripts could be seen from inside the worktree it\n   * executed against. That is now handled by the run's own source capture\n   * (`@archon/workflows` `workflow-source.ts`), which keeps the source outside the\n   * target entirely. The implicit copy is gone because it was never scoped to","sourceCodeStart":952,"sourceCodeEnd":988,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/isolation/src/providers/worktree.ts#L952-L988","documentation":"Any sync failure that is not clearly a permission, not-a-repo, or configured-branch problem is treated as a network/remote issue. Because creating a worktree from an unverified start point risks branching from the wrong commit, the sync failure is fatal and rethrown with a connectivity-oriented message.","triggerScenarios":"syncWorkspaceBeforeCreate's underlying `git fetch <remote> <branch>` fails with a network error, DNS failure, timeout, authentication prompt/credential error, or unknown remote — anything not matching the earlier classification branches.","commonSituations":"Offline laptop or CI without network egress; VPN required to reach the git host; expired SSH key/passphrase or cached credentials; remote renamed or deleted; firewall blocking port 22/443.","solutions":["Confirm connectivity to the git host (`git ls-remote <remote>` or `ssh -T git@github.com`)","Fix authentication: refresh SSH keys/agent (`ssh-add`) or update stored HTTPS credentials","Verify the remote URL is correct (`git remote -v`) and the branch exists on it","Retry when the network is available — the sync is intentionally retried from scratch, never skipped"],"exampleFix":"# before\nssh -T git@github.com  # Permission denied (publickey)\n# after\neval \"$(ssh-agent -s)\" && ssh-add ~/.ssh/id_ed25519 && ssh -T git@github.com","handlingStrategy":"retry","validationCode":"import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst execFileAsync = promisify(execFile);\nexport async function canReachRemote(repoPath: string, remote = 'origin'): Promise<boolean> {\n  try { await execFileAsync('git', ['-C', repoPath, 'ls-remote', '--exit-code', remote], { timeout: 15000 }); return true; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const env = await provider.create(request);\n} catch (e) {\n  const msg = (e as Error).message;\n  if (msg.startsWith('Failed to fetch base branch from')) {\n    // retry with backoff once connectivity/auth is verified\n    console.error('Network/remote problem; verify git ls-remote works, then retry.');\n  }\n  throw e;\n}","preventionTips":["Preflight `git ls-remote <remote>` in CI before runs requiring worktrees","Keep SSH keys loaded (ssh-agent) and HTTPS credentials fresh","Run network-dependent jobs only with confirmed egress/VPN","Ensure the configured base branch exists on the remote"],"tags":["network","git-fetch","remote","connectivity"],"backgroundTag":"git-fetch-network-failure","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}