infiniflow/ragflow · error · Error

Repository or path not found. Please check the URL and ensur

Error message

Repository or path not found. Please check the URL and ensure the repository is public.

What it means

Raised by the skill upload modal when the GitHub/Gitee contents API responds with HTTP 404 — the owner/repo/path/ref combination does not exist (or is not visible without authentication). The URL was syntactically parseable but points to nothing accessible.

Source

Thrown at web/src/pages/skills/components/upload-modal.tsx:388

        if (token) {
          url += `&access_token=${token}`;
        }
      }

      const response = await fetch(url, { headers });

      if (!response.ok) {
        const errorData = await response.json().catch(() => ({}));
        const message = errorData.message || `HTTP ${response.status}`;

        if (response.status === 403) {
          const limit = platform === 'github' ? '60' : '1000';
          throw new Error(
            `API rate limit exceeded. ${limit} requests/hour for unauthenticated requests.`,
          );
        }
        if (response.status === 404) {
          throw new Error(
            'Repository or path not found. Please check the URL and ensure the repository is public.',
          );
        }
        throw new Error(`Failed to fetch: ${message}`);
      }

      const items = await response.json();
      const files: GitFile[] = [];

      // Handle single file case
      if (!Array.isArray(items)) {
        if (items.type === 'file') {
          files.push({
            path: items.path,
            download_url: items.download_url,
            type: 'file',
            size: items.size,
          });

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Open the URL in a browser to verify owner/repo/branch/path all exist and are public
  2. Explicitly include the correct branch in the URL (e.g. tree/master) if the default branch is not 'main'
  3. For private repos, supply an access token in the modal's token field
  4. Double-check for typo'd path segments or stale links from documentation
Defensive patterns

Strategy: validation

Validate before calling

function normalizeGitUrl(raw: string): string | null {
  try {
    const u = new URL(raw.trim());
    if (!/(^|\.)github\.com$|(^|\.)gitee\.com$/.test(u.hostname)) return null;
    const parts = u.pathname.replace(/\.git$/, '').split('/').filter(Boolean);
    if (parts.length < 2) return null;
    return u.origin + '/' + parts.join('/');
  } catch {
    return null;
  }
}

const normalized = normalizeGitUrl(repoUrl);
if (!normalized) showUrlError();

Type guard

function isGitRepoUrl(v: string, platform: 'github' | 'gitee'): v is string {
  try {
    const u = new URL(v);
    return u.hostname.endsWith(`${platform}.com`) &&
      u.pathname.split('/').filter(Boolean).length >= 2;
  } catch {
    return false;
  }
}

Try / catch

try {
  const files = await fetchGitDirectoryContents(platform, owner, repo, path, ref, token);
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e);
  if (msg.includes('not found')) {
    setGitValidationStatus('invalid');
    setGitValidationMessage('Check the URL, branch, and that the repo is public.');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Typo in owner or repo name; the ref (branch/tag/sha) does not exist (common when defaulting to a branch like 'main' vs 'master'); the path does not exist in the repo at that ref; the repo is private and no token was given (GitHub returns 404, not 403, for private repos).

Common situations: Importing a repo whose default branch is 'master' while the importer assumes 'main'; referencing a subfolder that was renamed; URL pasted with a trailing period or extra path segment; private repo without token.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/f9f410720dc03797. Report an issue: GitHub.