{"record":{"id":"393e5319002533f4","repo":"coleam00/Archon","slug":"repository-owner-repo-not-found-or-is-privat-393e53","errorCode":null,"errorMessage":"Repository ${owner}/${repo} not found or is private. Check repository access.","messagePattern":"Repository (.+?)/(.+?) not found or is private\\. Check repository access\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/forge/github/adapter.ts","lineNumber":758,"sourceCode":"    } else {\n      ghToken = process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN;\n    }\n    const repoUrl = `https://github.com/${owner}/${repo}.git`;\n\n    const cloneResult = await cloneRepository(\n      repoUrl,\n      toRepoPath(repoPath),\n      ghToken ? { token: ghToken } : undefined\n    );\n\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","sourceCodeStart":740,"sourceCodeEnd":776,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/forge/github/adapter.ts#L740-L776","documentation":"GitHubAdapter.ensureRepoReady throws this when the git clone of https://github.com/${owner}/${repo}.git fails with error code 'not_a_repo', meaning git could not find a repository at that URL. Archon maps the low-level clone failure to a user-facing message distinguishing 'repo missing/private' from auth problems. It is thrown while preparing the codebase during webhook handling.","triggerScenarios":"Calling handleWebhook (which calls ensureRepoReady) for an owner/repo that does not exist, was renamed/deleted, or is private while the configured credentials (GitHub App installation or GITHUB_TOKEN) cannot see it.","commonSituations":"Typo in repo name from webhook payload; repo made private after initial setup; token belongs to a user without access; GitHub App not installed on that repo/org so the installation token cannot resolve it.","solutions":["Verify the repo exists at github.com/${owner}/${repo} and the spelling matches the webhook payload.","If the repo is private, confirm credentials: install the Archon GitHub App on the org or set a GITHUB_TOKEN with access to that repo.","Check the structured log 'github.repo_clone_failed' for the raw cloneResult.error to confirm it is genuinely a 404/not_a_repo and not an auth issue.","If the repo was renamed, update stored repo identifiers and re-trigger the webhook."],"exampleFix":"// before: webhook payload references old repo name\nhandleWebhook({ owner: 'acme', repo: 'old-name' })\n// after: corrected/re-registered repo\nhandleWebhook({ owner: 'acme', repo: 'renamed-repo' })","handlingStrategy":"validation","validationCode":"// Before handling the webhook, confirm access to the repo\nconst res = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {\n  headers: { Authorization: `Bearer ${token}`, Accept: 'application/vnd.github+json' },\n});\nif (res.status === 404) throw new Error(`Repo ${owner}/${repo} is inaccessible with current credentials`);","typeGuard":null,"tryCatchPattern":"try {\n  await adapter.handleWebhook(payload);\n} catch (err) {\n  if (err instanceof Error && /not found or is private\\. Check repository access/.test(err.message)) {\n    // surface repo-visibility/access guidance to the operator\n  }\n}","preventionTips":["Validate owner/repo against the GitHub API during webhook registration.","Keep the GitHub App installation covering all target repos with Contents:Read.","Monitor for repo rename/delete events and update stored identifiers."],"tags":["github","clone","not-found","permissions"],"backgroundTag":"git-repository-not-found","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}