{"record":{"id":"1a4f229cc7f92681","repo":"AlistGo/alist","slug":"mediafire-api-error-s-1a4f22","errorCode":null,"errorMessage":"MediaFire API error: %s","messagePattern":"MediaFire API error: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/mediafire/util.go","lineNumber":224,"sourceCode":"\t\t\"response_format\": \"json\",\n\t\t\"folder_key\":      folderKey,\n\t\t\"content_type\":    contentType,\n\t\t\"chunk\":           strconv.Itoa(chunkNumber),\n\t\t\"chunk_size\":      strconv.FormatInt(d.ChunkSize, 10),\n\t\t\"details\":         \"yes\",\n\t\t\"order_direction\": d.OrderDirection,\n\t\t\"order_by\":        d.OrderBy,\n\t\t\"filter\":          \"\",\n\t}\n\n\tvar resp MediafireResponse\n\t_, err := d.postForm(\"/folder/get_content.php\", data, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.Response.Result != \"Success\" {\n\t\treturn nil, fmt.Errorf(\"MediaFire API error: %s\", resp.Response.Result)\n\t}\n\n\treturn &resp, nil\n}\n\nfunc (d *Mediafire) fileToObj(f File) *model.ObjThumb {\n\tcreated, _ := time.Parse(\"2006-01-02T15:04:05Z\", f.CreatedUTC)\n\n\tvar thumbnailURL string\n\tif !f.IsFolder && f.ID != \"\" {\n\t\tthumbnailURL = d.hostBase + \"/convkey/acaa/\" + f.ID + \"3g.jpg\"\n\t}\n\n\treturn &model.ObjThumb{\n\t\tObject: model.Object{\n\t\t\tID: f.ID,\n\t\t\t//Path:     \"\",\n\t\t\tName:     f.Name,","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/mediafire/util.go#L206-L242","documentation":"getFolderContent posted to /folder/get_content.php and the response result was not 'Success'. This is the workhorse behind List: pagination chunks are fetched until folder_content_chunk is exhausted, so any chunk failing kills the whole listing. Causes: invalid/expired folder_key (root key misconfigured), session token expired, or the folder having been deleted or unshared.","triggerScenarios":"Listing a storage whose root_folder_key was deleted; token expired mid-pagination (large folders take several chunk requests); listing a shared folder whose share was revoked.","commonSituations":"Users pasting a folder key from a different account; big directories failing partway through due to token expiry; storage that worked yesterday but whose source folder was removed.","solutions":["Refresh the session token (getSessionToken) and retry the listing","Open the root folder key in the MediaFire web UI to confirm it exists and is accessible from this account","For very large folders, retry the failed chunk instead of restarting from chunk 1","Include resp.Response.Message in the error for the exact API reason"],"exampleFix":"// before: whole listing fails on one bad chunk\nfor hasMore {\n    resp, err := d.getFolderContent(ctx, folderKey, chunkNumber)\n    if err != nil {\n        return nil, err\n    }\n    ...\n}\n\n// after: refresh token once and retry the same chunk\nfor hasMore {\n    resp, err := d.getFolderContent(ctx, folderKey, chunkNumber)\n    if err != nil {\n        if _, tokErr := d.getSessionToken(ctx); tokErr == nil {\n            resp, err = d.getFolderContent(ctx, folderKey, chunkNumber)\n        }\n        if err != nil {\n            return nil, err\n        }\n    }\n    ...\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Wrap each chunk fetch: on API error, refresh the session token once and retry the same chunkNumber; on a second failure with 'invalid key' messages, abort with a clear 'root folder not accessible' error instead of an opaque result string.","preventionTips":["Verify the root folder key exists in the MediaFire UI when configuring the storage","Retry the failed pagination chunk, not the whole listing","Include response.message in errors; add token refresh before every long paginated operation"],"tags":["mediafire","api-error","list","pagination","authentication"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}