yamadashy/repomix · error · RepomixError

Repository not found or is private. Please check the reposit

Error message

Repository not found or is private. Please check the repository URL and your access permissions.

What it means

checkGitHubResponse maps an HTTP 404 from the GitHub archive/API endpoint to this friendly error. GitHub returns 404 for both nonexistent and private repositories (it does not leak existence), so the message covers both cases.

Source

Thrown at src/core/git/gitHubArchiveApi.ts:42

  }

  return `https://codeload.github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/tar.gz/master`;
};

/**
 * Builds alternative archive URL for tags
 * With codeload.github.com, refs are resolved automatically so tag fallback is no longer needed.
 */
export const buildGitHubTagArchiveUrl = (_repoInfo: GitHubRepoInfo): string | null => {
  return null;
};

/**
 * Checks if a response indicates a GitHub API rate limit or error
 */
export const checkGitHubResponse = (response: Response): void => {
  if (response.status === 404) {
    throw new RepomixError(
      'Repository not found or is private. Please check the repository URL and your access permissions.',
    );
  }

  if (response.status === 403) {
    const rateLimitRemaining = response.headers.get('X-RateLimit-Remaining');
    if (rateLimitRemaining === '0') {
      const resetTime = response.headers.get('X-RateLimit-Reset');
      const resetDate = resetTime ? new Date(Number.parseInt(resetTime, 10) * 1000) : null;
      throw new RepomixError(
        `GitHub API rate limit exceeded. ${resetDate ? `Rate limit resets at ${resetDate.toISOString()}` : 'Please try again later.'}`,
      );
    }
    throw new RepomixError(
      'Access denied. The repository might be private or you might not have permission to access it.',
    );
  }

View on GitHub (pinned to f465ad9093)

Solutions

  1. Verify the repository URL/owner/repo in a browser and correct any typo.
  2. If the repo is private, set a token: `export GITHUB_TOKEN=ghp_...` (or GH_TOKEN) with read access, and authorize it for SSO if the org requires it.
  3. Confirm the repo still exists (may have been renamed/deleted) and update the URL.

Example fix

// before (private repo, no token)
npx repomix --remote https://github.com/myorg/private-repo
// after
export GITHUB_TOKEN=ghp_yourTokenWithRepoScope
npx repomix --remote https://github.com/myorg/private-repo
Defensive patterns

Strategy: validation

Validate before calling

const repoUrl = 'https://github.com/owner/repo';
const res = await fetch(repoUrl, { headers: process.env.GITHUB_TOKEN ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } : {} });
if (!res.ok) throw new Error(`Repo inaccessible (${res.status}); check URL spelling or provide a token with access.`);

Try / catch

try {
  await pack({ remote: url });
} catch (e) {
  if (e instanceof RepomixError && e.message.includes('Repository not found or is private')) {
    console.error('Verify the repo URL and set GITHUB_TOKEN for private repos.');
  } else throw e;
}

Prevention

When it happens

Trigger: A GitHub API/archive request returns status 404 — the repository does not exist, the name/owner is misspelled, the repo is private, or the request was made without a token that grants access to a private repo.

Common situations: Typo in the owner/repo URL; trying to pack a private repo without a GITHUB_TOKEN; repo renamed or deleted; accessing a repo in an org that requires SSO authorization of your token.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/b2e2304750901dc6. Report an issue: GitHub.