infiniflow/ragflow · error · Error

Invalid ${PLATFORM_CONFIG[gitPlatform].name} URL format

Error message

Invalid ${PLATFORM_CONFIG[gitPlatform].name} URL format

What it means

Raised at the start of the git import flow when parseGitUrl cannot extract owner/repo/ref/path from the entered URL for the selected platform. The URL does not match the expected github.com/gitee.com repository URL patterns (e.g. https://host/owner/repo/tree/ref/path).

Source

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

    if (!validateGitVersion(gitVersion)) {
      setGitValidationStatus('invalid');
      setGitValidationMessage(
        t('skills.versionFormatHelp') ||
          'Version must be in semver format (e.g., 1.0.0)',
      );
      return;
    }

    setGitImporting(true);
    setGitProgress('Parsing repository URL...');
    setGitValidationStatus(null);
    setGitValidationMessage('');

    try {
      const parsed = parseGitUrl(repoUrl, gitPlatform);
      if (!parsed) {
        throw new Error(
          `Invalid ${PLATFORM_CONFIG[gitPlatform].name} URL format`,
        );
      }

      const { owner, repo, ref, path } = parsed;

      // 1. Fetch file list from Git API
      setGitProgress('Fetching file list...');
      const gitFiles = await fetchGitDirectoryContents(
        gitPlatform,
        owner,
        repo,
        path,
        ref,
        gitToken || undefined,
      );

      if (gitFiles.length === 0) {

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Use the full HTTPS web URL of the repository or folder, e.g. https://github.com/owner/repo/tree/main/skills
  2. Make sure the platform selector matches the URL's host
  3. Remove .git suffix, query strings, and fragments from the pasted URL
  4. If SSH-style input should be supported, extend parseGitUrl with that pattern
Defensive patterns

Strategy: validation

Validate before calling

function parseGitUrlSafe(url: string, platform: 'github' | 'gitee') {
  try {
    const u = new URL(url.trim());
    if (!u.hostname.endsWith(`${platform}.com`)) return null;
    const segs = u.pathname.replace(/\.git$/, '').split('/').filter(Boolean);
    if (segs.length < 2) return null;
    return {
      owner: segs[0],
      repo: segs[1],
      ref: segs[2] === 'tree' || segs[2] === 'blob' ? segs[3] ?? 'HEAD' : 'HEAD',
      path: segs[2] === 'tree' ? segs.slice(4).join('/') : '',
    };
  } catch {
    return null;
  }
}

const parsed = parseGitUrlSafe(repoUrl, gitPlatform);
if (!parsed) setGitValidationMessage('Use https://{platform}.com/owner/repo[/tree/branch/path]');

Type guard

function isSupportedGitUrl(v: string): v is string {
  try {
    const u = new URL(v);
    return /(\.|^)(github|gitee)\.com$/.test(u.hostname);
  } catch {
    return false;
  }
}

Try / catch

try {
  const parsed = parseGitUrl(repoUrl, gitPlatform);
  if (!parsed) throw new Error(`Invalid ${PLATFORM_CONFIG[gitPlatform].name} URL format`);
} catch (e) {
  setGitValidationStatus('invalid');
  setGitValidationMessage(e instanceof Error ? e.message : String(e));
  return; // keep modal open so the user can fix the URL
}

Prevention

When it happens

Trigger: Pasting an SSH URL (git@github.com:owner/repo.git), a URL with www or a different host, a bare 'owner/repo' shorthand, a URL for a platform different from the selected gitPlatform toggle, or extra segments that break the regex.

Common situations: Copying the clone URL instead of the browser URL; platform toggle set to 'gitee' while pasting a GitHub link; trailing '.git' suffix or query params (?tab=readme) not handled by the parser.

Related errors


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