AlistGo/alist · error
MediaFire API error: %s
Error message
MediaFire API error: %s
What it means
MakeDir posted to MediaFire's /folder/create.php and got an HTTP 200 JSON response whose response.result field is not 'Success' — e.g. 'Error' with a message. The %s prints only the result code, so the API's human-readable message field (usually also present in the payload) is lost. Typical causes: invalid/expired parent folder key, duplicate folder name, or session token revoked.
Source
Thrown at drivers/mediafire/driver.go:138
}, nil
}
func (d *Mediafire) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {
data := map[string]string{
"session_token": d.SessionToken,
"response_format": "json",
"parent_key": parentDir.GetID(),
"foldername": dirName,
}
var resp MediafireFolderCreateResponse
_, err := d.postForm("/folder/create.php", data, &resp)
if err != nil {
return nil, err
}
if resp.Response.Result != "Success" {
return nil, fmt.Errorf("MediaFire API error: %s", resp.Response.Result)
}
created, _ := time.Parse("2006-01-02T15:04:05Z", resp.Response.CreatedUTC)
return &model.ObjThumb{
Object: model.Object{
ID: resp.Response.FolderKey,
Name: resp.Response.Name,
Size: 0,
Modified: created,
Ctime: created,
IsFolder: true,
},
Thumbnail: model.Thumbnail{},
}, nil
}
func (d *Mediafire) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {View on GitHub (pinned to 843d9dc814)
Solutions
- Retry once after forcing a token refresh (call getSessionToken) — expired tokens are the most frequent cause
- Verify the parent folder key still exists by listing it in the MediaFire web UI
- If a duplicate name, list the destination first and reuse the existing folder
- Improve the error to include resp.Response.Message so the real API reason is visible
Example fix
// before: only the result code is reported
if resp.Response.Result != "Success" {
return nil, fmt.Errorf("MediaFire API error: %s", resp.Response.Result)
}
// after: include the API's message field for a diagnosable error
if resp.Response.Result != "Success" {
return nil, fmt.Errorf("MediaFire API error: %s: %s", resp.Response.Result, resp.Response.Message)
} Defensive patterns
Strategy: retry
Try / catch
On 'MediaFire API error' from folder/create: refresh the session token once (getSessionToken), retry MakeDir; if it still fails, surface the API message. Also pre-check for an existing folder with the same name via List to avoid duplicate-name results.
Prevention
- Wrap all MediaFire mutating calls in a retry-once-after-token-refresh helper
- Include response.message in error strings for diagnosability
- Idempotency-check directory creation by listing the parent first
When it happens
Trigger: Creating a folder under a parent whose folder_key was deleted; creating a folder when the session token expired mid-session; MediaFire rate-limiting the scraping-style API.
Common situations: Long-running instances whose cron-based token renewal (every 6-9 minutes) failed silently, then a mkdir request arrives; concurrent uploads racing to create the same directory.
Related errors
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/f6e4d282d0221deb.
Report an issue: GitHub.