{"record":{"id":"16cde1c01ba3415a","repo":"coleam00/Archon","slug":"failed-to-clone-owner-repo-message-in-c","errorCode":null,"errorMessage":"Failed to clone ${owner}/${repo}: ${'message' in cloneResult.error ? cloneResult.error.message : cloneResult.error.code}","messagePattern":"Failed to clone (.+?)/(.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/forge/github/adapter.ts","lineNumber":768,"sourceCode":"\n    if (!cloneResult.ok) {\n      getLog().error(\n        { error: cloneResult.error, owner, repo, repoPath },\n        'github.repo_clone_failed'\n      );\n\n      if (cloneResult.error.code === 'not_a_repo') {\n        throw new Error(\n          `Repository ${owner}/${repo} not found or is private. Check repository access.`\n        );\n      } else if (cloneResult.error.code === 'permission_denied') {\n        const authHint =\n          this.auth.kind === 'app'\n            ? 'Check that the Archon GitHub App is installed on the org and has the Contents:Read permission.'\n            : 'Check GITHUB_TOKEN permissions.';\n        throw new Error(`Authentication failed for ${owner}/${repo}. ${authHint}`);\n      }\n      throw new Error(\n        `Failed to clone ${owner}/${repo}: ${'message' in cloneResult.error ? cloneResult.error.message : cloneResult.error.code}`\n      );\n    }\n\n    await addSafeDirectory(toRepoPath(repoPath));\n\n    // App mode: install the git credential helper on the newly cloned worktree\n    // so workflows that outlive the 1h installation-token expiry can refresh\n    // credentials in-place. Non-fatal — workflows that complete in <1h still\n    // succeed via the URL-embedded token from the clone above. The result\n    // discriminator tells us whether the install actually happened so we\n    // don't log a false \"installed\" line in builds where the helper script\n    // isn't on disk.\n    if (this.auth.kind === 'app') {\n      const result = await installCredentialHelper(repoPath);\n      switch (result.kind) {\n        case 'installed':\n          getLog().info(","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/forge/github/adapter.ts#L750-L786","documentation":"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.","triggerScenarios":"handleWebhook -> ensureRepoReady -> cloneRepository fails with a non-classified code: DNS failure, timeout, git binary missing, corrupt target directory, protocol errors.","commonSituations":"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.","solutions":["Read the embedded message/code in the error and the 'github.repo_clone_failed' log entry to identify the underlying git failure.","Check outbound network/DNS/proxy access to github.com from the host running Archon.","Confirm git is installed and the target repoPath filesystem is writable with sufficient space.","Delete a partially-created/cluttered repoPath and retry the run to force a clean clone."],"exampleFix":"// before: container without git\nFROM node:22-slim\n// after\nFROM node:22-slim\nRUN apt-get update && apt-get install -y git","handlingStrategy":"retry","validationCode":"// Pre-flight: git present and network reachable\nconst gitOk = await new Promise(r => { const p = Bun.spawnSync(['git', '--version']); r(p.exitCode === 0); });\nconst net = await fetch('https://github.com', { method: 'HEAD' }).then(() => true, () => false);\nif (!gitOk || !net) throw new Error('git or network unavailable for clone');","typeGuard":null,"tryCatchPattern":"try {\n  await adapter.handleWebhook(payload);\n} catch (err) {\n  const msg = err instanceof Error ? err.message : '';\n  if (msg.startsWith('Failed to clone ') && isTransient(msg)) {\n    await backoffRetry(() => adapter.handleWebhook(payload), 3);\n  }\n}","preventionTips":["Install git in the runtime image and verify disk space under the project path.","Add a bounded backoff retry for transient clone failures.","Alert on 'github.repo_clone_failed' log entries with non-auth codes.","Clean up partial clone directories on failure."],"tags":["github","clone","network","git"],"backgroundTag":"git-clone-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}