coleam00/Archon · error

Failed to clone ${owner}/${repo}: ${'message' in cloneResult

Error message

Failed to clone ${owner}/${repo}: ${'message' in cloneResult.error ? cloneResult.error.message : cloneResult.error.code}

What it means

Generic clone-failure branch of GitHubAdapter.ensureRepoReady: any cloneRepository error that is neither 'not_a_repo' nor 'permission_denied' is re-thrown verbatim, carrying the underlying git message or error code. This surfaces network outages, disk errors, bad remotes, or unexpected git failures during webhook-driven repo setup.

Source

Thrown at packages/adapters/src/forge/github/adapter.ts:768

    if (!cloneResult.ok) {
      getLog().error(
        { error: cloneResult.error, owner, repo, repoPath },
        'github.repo_clone_failed'
      );

      if (cloneResult.error.code === 'not_a_repo') {
        throw new Error(
          `Repository ${owner}/${repo} not found or is private. Check repository access.`
        );
      } else if (cloneResult.error.code === 'permission_denied') {
        const authHint =
          this.auth.kind === 'app'
            ? 'Check that the Archon GitHub App is installed on the org and has the Contents:Read permission.'
            : 'Check GITHUB_TOKEN permissions.';
        throw new Error(`Authentication failed for ${owner}/${repo}. ${authHint}`);
      }
      throw new Error(
        `Failed to clone ${owner}/${repo}: ${'message' in cloneResult.error ? cloneResult.error.message : cloneResult.error.code}`
      );
    }

    await addSafeDirectory(toRepoPath(repoPath));

    // App mode: install the git credential helper on the newly cloned worktree
    // so workflows that outlive the 1h installation-token expiry can refresh
    // credentials in-place. Non-fatal — workflows that complete in <1h still
    // succeed via the URL-embedded token from the clone above. The result
    // discriminator tells us whether the install actually happened so we
    // don't log a false "installed" line in builds where the helper script
    // isn't on disk.
    if (this.auth.kind === 'app') {
      const result = await installCredentialHelper(repoPath);
      switch (result.kind) {
        case 'installed':
          getLog().info(

View on GitHub (pinned to 0773b97458)

Solutions

  1. Read the embedded message/code in the error and the 'github.repo_clone_failed' log entry to identify the underlying git failure.
  2. Check outbound network/DNS/proxy access to github.com from the host running Archon.
  3. Confirm git is installed and the target repoPath filesystem is writable with sufficient space.
  4. Delete a partially-created/cluttered repoPath and retry the run to force a clean clone.

Example fix

// before: container without git
FROM node:22-slim
// after
FROM node:22-slim
RUN apt-get update && apt-get install -y git
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: git present and network reachable
const gitOk = await new Promise(r => { const p = Bun.spawnSync(['git', '--version']); r(p.exitCode === 0); });
const net = await fetch('https://github.com', { method: 'HEAD' }).then(() => true, () => false);
if (!gitOk || !net) throw new Error('git or network unavailable for clone');

Try / catch

try {
  await adapter.handleWebhook(payload);
} catch (err) {
  const msg = err instanceof Error ? err.message : '';
  if (msg.startsWith('Failed to clone ') && isTransient(msg)) {
    await backoffRetry(() => adapter.handleWebhook(payload), 3);
  }
}

Prevention

When it happens

Trigger: handleWebhook -> ensureRepoReady -> cloneRepository fails with a non-classified code: DNS failure, timeout, git binary missing, corrupt target directory, protocol errors.

Common situations: No outbound network from the server running Archon; corporate proxy blocking github.com; disk full or read-only volumes under the project path; git not installed in the container.

Related errors


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