{"record":{"id":"dd6697204d2ab15b","repo":"AlistGo/alist","slug":"mediafire-upload-check-failed-s","errorCode":null,"errorMessage":"MediaFire upload check failed: %s","messagePattern":"MediaFire upload check failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/mediafire/util.go","lineNumber":375,"sourceCode":"\t\t\"folder_key\":      folderKey,\n\t\t\"resumable\":       \"yes\",\n\t\t\"response_format\": \"json\",\n\t}\n\n\tvar resp MediafireCheckResponse\n\t_, err = d.postForm(\"/upload/check.php\", query, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//fmt.Printf(\"uploadCheck :: Raw response: %s\\n\", string(body))\n\t//fmt.Printf(\"uploadCheck :: Parsed response: %+v\\n\", resp)\n\n\t//fmt.Printf(\"uploadCheck :: ResumableUpload section: %+v\\n\", resp.Response.ResumableUpload)\n\t//fmt.Printf(\"uploadCheck :: Upload key specifically: '%s'\\n\", resp.Response.ResumableUpload.UploadKey)\n\n\tif resp.Response.Result != \"Success\" {\n\t\treturn nil, fmt.Errorf(\"MediaFire upload check failed: %s\", resp.Response.Result)\n\t}\n\n\treturn &resp, nil\n}\n\nfunc (d *Mediafire) resumableUpload(ctx context.Context, folderKey, uploadKey string, unitData []byte, unitID int, fileHash, filename string, totalFileSize int64) (string, error) {\n\tactionToken, err := d.getActionToken(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\turl := d.apiBase + \"/upload/resumable.php\"\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(unitData))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tq := req.URL.Query()","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/mediafire/util.go#L357-L393","documentation":"The MediaFire upload pre-check endpoint /upload/check.php responded with a Result other than Success. This endpoint validates filename, size, SHA-256 hash, and folder before a resumable upload begins; a non-Success result means MediaFire refused to start or resume the upload. The %s carries MediaFire's own result/error message.","triggerScenarios":"folder_key pointing to a deleted or inaccessible folder; file size or hash rejected (e.g. hash format wrong — MediaFire expects hex SHA-256); filename containing disallowed characters; account storage quota exceeded; session/action token invalid at check time.","commonSituations":"Upload attempted into a folder that was removed in the web UI; hash computed over a partially written file so the pre-check hash mismatches metadata later; quota exhaustion on free accounts; special characters in filenames from cross-platform renames.","solutions":["Read the embedded result string — it names the exact refusal reason (e.g. \"Invalid folder_key\", \"Storage quota exceeded\")","Verify folder_key by listing the parent folder before upload","Confirm the hash passed in is a lowercase hex SHA-256 of the full file and the size matches os.Stat","Free space or upgrade the account if quota is the cause; re-login if the message indicates an auth problem"],"exampleFix":"// before\nif resp.Response.Result != \"Success\" {\n    return nil, fmt.Errorf(\"MediaFire upload check failed: %s\", resp.Response.Result)\n}\n\n// after\nif resp.Response.Result != \"Success\" {\n    if strings.Contains(resp.Response.Result, \"folder\") {\n        return nil, fmt.Errorf(\"MediaFire upload check failed (bad folder_key %s): %s\", folderKey, resp.Response.Result)\n    }\n    return nil, fmt.Errorf(\"MediaFire upload check failed: %s\", resp.Response.Result)\n}","handlingStrategy":"validation","validationCode":"// Pre-validate upload inputs before hitting check.php\nif folderKey == \"\" { return errors.New(\"folder_key required\") }\nif filesize <= 0 { return errors.New(\"invalid file size\") }\nif len(filehash) != 64 { return errors.New(\"hash must be 64-char hex SHA-256\") }\nif _, err := hex.DecodeString(filehash); err != nil { return fmt.Errorf(\"bad hash: %w\", err) }","typeGuard":null,"tryCatchPattern":"// Treat folder/quota results as permanent, others as retriable\nif err := uploadCheck(...); err != nil {\n    msg := err.Error()\n    switch {\n    case strings.Contains(msg, \"folder\"), strings.Contains(msg, \"quota\"):\n        return err // permanent: fix config or space\n    default:\n        return retryAfter(time.Second, func() error { return uploadCheck(...) })\n    }\n}","preventionTips":["Validate folder_key by listing the parent before upload","Compute the hash from a fully flushed file","Keep the result string in errors so quota/folder causes are visible"],"tags":["mediafire","upload","api-error","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}