{"record":{"id":"b6a4720ee14b0996","repo":"AlistGo/alist","slug":"no-download-links-found","errorCode":null,"errorMessage":"no download links found","messagePattern":"no download links found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/mediafire/util.go","lineNumber":328,"sourceCode":"\tdata := map[string]string{\n\t\t\"session_token\":   d.SessionToken,\n\t\t\"quick_key\":       fileID,\n\t\t\"link_type\":       \"direct_download\",\n\t\t\"response_format\": \"json\",\n\t}\n\n\tvar resp MediafireDirectDownloadResponse\n\t_, err := d.getForm(\"/file/get_links.php\", data, &resp)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif resp.Response.Result != \"Success\" {\n\t\treturn \"\", fmt.Errorf(\"MediaFire API error: %s\", resp.Response.Result)\n\t}\n\n\tif len(resp.Response.Links) == 0 {\n\t\treturn \"\", fmt.Errorf(\"no download links found\")\n\t}\n\n\treturn resp.Response.Links[0].DirectDownload, nil\n}\n\nfunc (d *Mediafire) calculateSHA256(file *os.File) (string, error) {\n\thasher := sha256.New()\n\tif _, err := file.Seek(0, 0); err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := io.Copy(hasher, file); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(hasher.Sum(nil)), nil\n}\n\nfunc (d *Mediafire) uploadCheck(ctx context.Context, filename string, filesize int64, filehash, folderKey string) (*MediafireCheckResponse, error) {\n","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/mediafire/util.go#L310-L346","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry once after a short delay — files freshly uploaded may not be linkable immediately","Verify the account supports direct downloads; if not, fall back to a normal download link type","Re-fetch the file info to confirm the file still exists and is in a normal state","If using link_type=direct_download, try omitting it and inspect which link types the API returns"],"exampleFix":"// before\nif len(resp.Response.Links) == 0 {\n    return \"\", fmt.Errorf(\"no download links found\")\n}\nreturn resp.Response.Links[0].DirectDownload, nil\n\n// after\nif len(resp.Response.Links) == 0 {\n    return \"\", fmt.Errorf(\"no download links found (result=%s, account may lack direct-download permission)\", resp.Response.Result)\n}\nreturn resp.Response.Links[0].DirectDownload, nil","handlingStrategy":"retry","validationCode":"// Probe link availability once before exposing a direct-download feature\nif _, err := d.getDirectDownloadLink(ctx, fileID); err != nil {\n    if strings.Contains(err.Error(), \"no download links\") {\n        // mark direct download unsupported for this account/file\n        directDownloadSupported = false\n    }\n}","typeGuard":null,"tryCatchPattern":"// Retry after delay once, then degrade gracefully\nlink, err := d.getDirectLink(ctx, id)\nif err != nil && strings.Contains(err.Error(), \"no download links\") {\n    time.Sleep(2 * time.Second)\n    link, err = d.getDirectLink(ctx, id)\n}","preventionTips":["Confirm the account plan supports direct downloads before enabling the feature","Wait for newly uploaded files to finish processing before linking","Cache negative results briefly to avoid hammering the API"],"tags":["mediafire","empty-response","download-link","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}