AlistGo/alist · error

no download links found

Error message

no download links found

What it means

Returned when /file/get_links.php answers with Result=Success but the Links array is empty, so there is no DirectDownload URL to hand back. MediaFire acknowledged the request yet produced zero link records, typically because the direct_download link type is not available for this file or account. It is a data-shape failure, not an HTTP failure.

Source

Thrown at drivers/mediafire/util.go:328

	data := map[string]string{
		"session_token":   d.SessionToken,
		"quick_key":       fileID,
		"link_type":       "direct_download",
		"response_format": "json",
	}

	var resp MediafireDirectDownloadResponse
	_, err := d.getForm("/file/get_links.php", data, &resp)
	if err != nil {
		return "", err
	}

	if resp.Response.Result != "Success" {
		return "", fmt.Errorf("MediaFire API error: %s", resp.Response.Result)
	}

	if len(resp.Response.Links) == 0 {
		return "", fmt.Errorf("no download links found")
	}

	return resp.Response.Links[0].DirectDownload, nil
}

func (d *Mediafire) calculateSHA256(file *os.File) (string, error) {
	hasher := sha256.New()
	if _, err := file.Seek(0, 0); err != nil {
		return "", err
	}
	if _, err := io.Copy(hasher, file); err != nil {
		return "", err
	}
	return hex.EncodeToString(hasher.Sum(nil)), nil
}

func (d *Mediafire) uploadCheck(ctx context.Context, filename string, filesize int64, filehash, folderKey string) (*MediafireCheckResponse, error) {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry once after a short delay — files freshly uploaded may not be linkable immediately
  2. Verify the account supports direct downloads; if not, fall back to a normal download link type
  3. Re-fetch the file info to confirm the file still exists and is in a normal state
  4. If using link_type=direct_download, try omitting it and inspect which link types the API returns

Example fix

// before
if len(resp.Response.Links) == 0 {
    return "", fmt.Errorf("no download links found")
}
return resp.Response.Links[0].DirectDownload, nil

// after
if len(resp.Response.Links) == 0 {
    return "", fmt.Errorf("no download links found (result=%s, account may lack direct-download permission)", resp.Response.Result)
}
return resp.Response.Links[0].DirectDownload, nil
Defensive patterns

Strategy: retry

Validate before calling

// Probe link availability once before exposing a direct-download feature
if _, err := d.getDirectDownloadLink(ctx, fileID); err != nil {
    if strings.Contains(err.Error(), "no download links") {
        // mark direct download unsupported for this account/file
        directDownloadSupported = false
    }
}

Try / catch

// Retry after delay once, then degrade gracefully
link, err := d.getDirectLink(ctx, id)
if err != nil && strings.Contains(err.Error(), "no download links") {
    time.Sleep(2 * time.Second)
    link, err = d.getDirectLink(ctx, id)
}

Prevention

When it happens

Trigger: Account without direct-download permission requesting link_type=direct_download; file in a state that cannot be linked (processing, flagged, or abuse-limited); API quirk where Success is returned but links are omitted for unsupported link types.

Common situations: Free MediaFire accounts (direct download is a paid feature); files that exceed free-tier size limits for direct linking; intermittent API behavior right after upload before the file is fully processed.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/b6a4720ee14b0996. Report an issue: GitHub.