{"record":{"id":"e43f03e68427e2fa","repo":"coleam00/Archon","slug":"repository-owner-repo-not-found-or-is-privat","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/community/forge/gitea/adapter.ts","lineNumber":548,"sourceCode":"    getLog().info({ owner, repo, repoPath }, 'repo_cloning');\n\n    // Create project structure (source/, worktrees/, artifacts/, logs/) before\n    // cloning so worktree paths resolve correctly on first webhook clone.\n    await ensureProjectStructure(owner, repo);\n\n    // Parse URL to get host for authenticated clone\n    const urlObj = new URL(this.baseUrl);\n    const repoUrl = `${urlObj.protocol}//${urlObj.host}/${owner}/${repo}.git`;\n\n    const cloneResult = await cloneRepository(repoUrl, toRepoPath(repoPath), {\n      token: process.env.GITEA_TOKEN,\n    });\n\n    if (!cloneResult.ok) {\n      getLog().error({ owner, repo, repoPath, error: cloneResult.error }, 'repo_clone_failed');\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      }\n      if (cloneResult.error.code === 'permission_denied') {\n        throw new Error(\n          `Authentication failed for ${owner}/${repo}. Check GITEA_TOKEN permissions.`\n        );\n      }\n      const unknownMsg = (cloneResult.error as { message?: string }).message ?? 'unknown error';\n      throw new Error(`Failed to clone ${owner}/${repo}: ${unknownMsg}`);\n    }\n\n    await addSafeDirectory(toRepoPath(repoPath));\n  }\n\n  /**\n   * Auto-detect and load commands from .archon/commands/ (or configured folder)\n   */","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/community/forge/gitea/adapter.ts#L530-L566","documentation":"ensureRepoReady attempts to clone owner/repo when the local directory is missing. When the clone operation reports error code 'not_a_repo', the adapter throws this message: either the repository does not exist or the credentials cannot see it (private repos look identical to nonexistent ones over the API).","triggerScenarios":"handleWebhook -> ensureRepoReady with a repo deleted/renamed since the webhook was configured, a typo'd owner/repo slug, or a private repository where GITEA_TOKEN is missing/invalid so Gitea answers as if the repo is absent (404).","commonSituations":"Repository renamed or transferred to another owner; token expired so private repos return 404; webhook configured against a fork that was deleted; wrong Gitea instance URL configured.","solutions":["Verify owner/repo exists at the configured Gitea instance (open it in the browser or GET /api/v1/repos/{owner}/{repo}).","Confirm GITEA_TOKEN is set and valid — a 404 on a private repo usually means auth failed, not that the repo is gone.","Update the adapter configuration if the repository was renamed or transferred.","Ensure the token's user has at least read access to the repository."],"exampleFix":"// before\nGITEA_TOKEN=ghp_old_expired_token\n\n// after\nGITEA_TOKEN=<freshly generated Gitea token with repo read scope>\n# verify: curl -H \"Authorization: token $GITEA_TOKEN\" https://gitea.example.com/api/v1/repos/owner/repo","handlingStrategy":"validation","validationCode":"const res = await fetch(`${giteaUrl}/api/v1/repos/${owner}/${repo}`, { headers: { Authorization: `token ${token}` } });\nif (res.status === 404) throw new Error(`Repo ${owner}/${repo} invisible to token: check existence and privacy`);","typeGuard":null,"tryCatchPattern":"try {\n  await adapter.handleWebhook(update);\n} catch (err) {\n  if (String(err).includes('not found or is private')) {\n    getLog().error({ owner, repo }, 'verify_repo_exists_and_token_read_scope');\n  }\n  throw err;\n}","preventionTips":["Probe GET /api/v1/repos/{owner}/{repo} with the configured token at startup.","Update adapter config immediately after renaming/transferring repositories.","Remember a private repo 404s without valid auth — check the token first.","Use a token whose user is a member of the target org/repo."],"tags":["gitea","clone","auth"],"backgroundTag":"repository-not-found","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}