coleam00/Archon · error

Repository ${owner}/${repo} not found or is private. Check r

Error message

Repository ${owner}/${repo} not found or is private. Check repository access.

What it means

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).

Source

Thrown at packages/adapters/src/community/forge/gitea/adapter.ts:548

    getLog().info({ owner, repo, repoPath }, 'repo_cloning');

    // Create project structure (source/, worktrees/, artifacts/, logs/) before
    // cloning so worktree paths resolve correctly on first webhook clone.
    await ensureProjectStructure(owner, repo);

    // Parse URL to get host for authenticated clone
    const urlObj = new URL(this.baseUrl);
    const repoUrl = `${urlObj.protocol}//${urlObj.host}/${owner}/${repo}.git`;

    const cloneResult = await cloneRepository(repoUrl, toRepoPath(repoPath), {
      token: process.env.GITEA_TOKEN,
    });

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

      if (cloneResult.error.code === 'not_a_repo') {
        throw new Error(
          `Repository ${owner}/${repo} not found or is private. Check repository access.`
        );
      }
      if (cloneResult.error.code === 'permission_denied') {
        throw new Error(
          `Authentication failed for ${owner}/${repo}. Check GITEA_TOKEN permissions.`
        );
      }
      const unknownMsg = (cloneResult.error as { message?: string }).message ?? 'unknown error';
      throw new Error(`Failed to clone ${owner}/${repo}: ${unknownMsg}`);
    }

    await addSafeDirectory(toRepoPath(repoPath));
  }

  /**
   * Auto-detect and load commands from .archon/commands/ (or configured folder)
   */

View on GitHub (pinned to 0773b97458)

Solutions

  1. Verify owner/repo exists at the configured Gitea instance (open it in the browser or GET /api/v1/repos/{owner}/{repo}).
  2. Confirm GITEA_TOKEN is set and valid — a 404 on a private repo usually means auth failed, not that the repo is gone.
  3. Update the adapter configuration if the repository was renamed or transferred.
  4. Ensure the token's user has at least read access to the repository.

Example fix

// before
GITEA_TOKEN=ghp_old_expired_token

// after
GITEA_TOKEN=<freshly generated Gitea token with repo read scope>
# verify: curl -H "Authorization: token $GITEA_TOKEN" https://gitea.example.com/api/v1/repos/owner/repo
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`${giteaUrl}/api/v1/repos/${owner}/${repo}`, { headers: { Authorization: `token ${token}` } });
if (res.status === 404) throw new Error(`Repo ${owner}/${repo} invisible to token: check existence and privacy`);

Try / catch

try {
  await adapter.handleWebhook(update);
} catch (err) {
  if (String(err).includes('not found or is private')) {
    getLog().error({ owner, repo }, 'verify_repo_exists_and_token_read_scope');
  }
  throw err;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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