infiniflow/ragflow · error · Error
Download URL not available for file: ${file.path}
Error message
Download URL not available for file: ${file.path} What it means
Raised during file download when no download URL could be determined: the git API listing provided no download_url AND the platform-specific raw URL could not be constructed because the detected platform matched neither 'github' nor 'gitee'. It indicates either an unsupported platform value or a listing entry lacking download_url for a platform without a raw-URL fallback.
Source
Thrown at web/src/pages/skills/components/upload-modal.tsx:509
repo: string,
ref: string,
): Promise<File> => {
let downloadUrl = file.download_url;
const config = PLATFORM_CONFIG[platform];
// If download_url is not provided, construct raw URL
if (!downloadUrl) {
if (platform === 'github') {
// https://raw.githubusercontent.com/owner/repo/ref/path
downloadUrl = `${config.rawBase}/${owner}/${repo}/${ref}/${file.path}`;
} else if (platform === 'gitee') {
// https://gitee.com/owner/repo/raw/ref/path
downloadUrl = `${config.rawBase}/${owner}/${repo}/raw/${ref}/${file.path}`;
}
}
if (!downloadUrl) {
throw new Error(`Download URL not available for file: ${file.path}`);
}
const response = await fetch(downloadUrl);
if (!response.ok) {
throw new Error(
`Failed to download ${file.path}: ${response.status} ${response.statusText}`,
);
}
const blob = await response.blob();
const fileName = file.path.split('/').pop() || 'file';
// Use MIME type from extension if blob.type is empty or generic
let fileType = blob.type;
if (
!fileType ||
fileType === 'application/octet-stream' ||
fileType === 'text/plain'View on GitHub (pinned to 554fb1133a)
Solutions
- Confirm the import URL is for github.com or gitee.com — other hosts are not supported
- Exclude submodule/directory entries from the file list before download (filter f.type === 'file')
- If adding a new platform, add its raw URL construction branch in the download function
- Inspect the file entry for a missing download_url via the browser debugger
Example fix
// before
if (!downloadUrl) {
if (platform === 'github') { ... } else if (platform === 'gitee') { ... }
}
if (!downloadUrl) {
throw new Error(`Download URL not available for file: ${file.path}`);
}
// after
if (!downloadUrl && platform === 'github') {
downloadUrl = `${config.rawBase}/${owner}/${repo}/${ref}/${file.path}`;
} else if (!downloadUrl && platform === 'gitee') {
downloadUrl = `${config.rawBase}/${owner}/${repo}/raw/${ref}/${file.path}`;
}
// skip entries that are still unresolved (e.g. submodules)
if (!downloadUrl) continue; // inside the per-file loop Defensive patterns
Strategy: type-guard
Validate before calling
const SUPPORTED_PLATFORMS = ['github', 'gitee'] as const;
if (!SUPPORTED_PLATFORMS.includes(platform)) {
showWarning(`Platform '${platform}' is not supported for raw downloads`);
}
// filter entries that can actually be downloaded
const downloadable = files.filter(
(f) => f.type === 'file' && (f.download_url || platform === 'github' || platform === 'gitee'),
); Type guard
function hasDownloadPath(f: { download_url?: string; path: string }, platform: string): boolean {
if (f.download_url) return true;
return platform === 'github' || platform === 'gitee'; // raw URL constructible
} Try / catch
for (const file of files) {
try {
downloaded.push(await downloadGitFile(platform, owner, repo, ref, file, token));
} catch (e) {
if (e instanceof Error && e.message.startsWith('Download URL not available')) {
continue; // skip unsupported entry (e.g. submodule), keep importing the rest
}
downloadErrors.push(`${file.path}: ${e instanceof Error ? e.message : e}`);
}
} Prevention
- Restrict the platform selector to hosts with raw URL rules implemented
- Filter listing entries to type === 'file' before attempting downloads
- When adding a new git host, add its raw URL construction in the same change
When it happens
Trigger: parseGitUrl/gitPlatform yields a platform string other than 'github'/'gitee'; a directory entry or submodule in the file list has download_url undefined and the platform branch falls through; ref/path components empty making the constructed URL invalid (though non-empty string still passes).
Common situations: New git host support half-added (platform enum extended without a raw URL rule); git submodule entries in the repo tree; API responses from Gitee enterprise endpoints that omit download_url.
Related errors
- Failed to download ${file.path}: ${response.status} ${respon
- No files could be downloaded. Errors:\n${downloadErrors.slic
- API rate limit exceeded. ${limit} requests/hour for unauthen
- Repository or path not found. Please check the URL and ensur
- Failed to fetch: ${message}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/352ba91afda3f55c.
Report an issue: GitHub.