{"record":{"id":"2ad0570dae4688b1","repo":"AlistGo/alist","slug":"mediafire-poll-upload-failed-s","errorCode":null,"errorMessage":"MediaFire poll upload failed: %s","messagePattern":"MediaFire poll upload failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/mediafire/util.go","lineNumber":562,"sourceCode":"\tquery := map[string]string{\n\t\t\"key\":             key,\n\t\t\"response_format\": \"json\",\n\t\t\"session_token\":   actionToken, /* d.SessionToken */\n\t}\n\n\tvar resp MediafirePollResponse\n\t_, err = d.postForm(\"/upload/poll_upload.php\", query, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//fmt.Printf(\"pollUpload :: Raw response: %s\\n\", string(body))\n\t//fmt.Printf(\"pollUpload :: Parsed response: %+v\\n\", resp)\n\n\t//fmt.Printf(\"pollUpload :: Debug Result: %+v\\n\", resp.Response.Result)\n\n\tif resp.Response.Result != \"Success\" {\n\t\treturn nil, fmt.Errorf(\"MediaFire poll upload failed: %s\", resp.Response.Result)\n\t}\n\n\treturn &resp, nil\n}\n\nfunc (d *Mediafire) sha256Hex(r io.Reader) string {\n\th := sha256.New()\n\tio.Copy(h, r)\n\treturn hex.EncodeToString(h.Sum(nil))\n}\n\nfunc (d *Mediafire) isUnitUploaded(words []int, unitID int) bool {\n\twordIndex := unitID / 16\n\tbitIndex := unitID % 16\n\tif wordIndex >= len(words) {\n\t\treturn false\n\t}\n\treturn (words[wordIndex]>>bitIndex)&1 == 1","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/mediafire/util.go#L544-L580","documentation":"The upload status poll endpoint /upload/poll_upload.php returned Result != Success. Polling reports whether the assembled upload is complete; a non-Success result means MediaFire could not report status for the given key — usually an unknown/expired upload key, an auth problem, or an upload that failed server-side (hash mismatch, disk issue).","triggerScenarios":"Poll key invalid because the upload already finished or was garbage-collected; action/session token rejected at poll time; server-side assembly failure such as final hash mismatch; polling too long after the upload key expired.","commonSituations":"Resuming an old upload whose key has expired; interrupted uploads where the client restarts polling hours later; hash mismatch when the file changed during upload; account issues surfacing mid-poll.","solutions":["Read the embedded result string: \"Invalid key\" style results mean re-run uploadCheck and restart the resumable upload from the bitmap; auth results mean re-login","Verify the file on MediaFire by listing the destination folder — the upload may have completed despite the poll failure (defensive dedup by hash)","Retry polling a few times with delay before declaring failure; transient result errors occur during assembly","If hash mismatch is indicated, recompute SHA-256 and re-upload from scratch"],"exampleFix":"// before\nif resp.Response.Result != \"Success\" {\n    return nil, fmt.Errorf(\"MediaFire poll upload failed: %s\", resp.Response.Result)\n}\n\n// after\nif resp.Response.Result != \"Success\" {\n    if strings.Contains(strings.ToLower(resp.Response.Result), \"key\") {\n        // upload key expired/unknown: check if file actually landed\n        if _, err := d.getFileByHash(ctx, fileHash); err == nil {\n            return nil, nil // treat as completed; caller verifies by hash\n        }\n    }\n    return nil, fmt.Errorf(\"MediaFire poll upload failed: %s\", resp.Response.Result)\n}","handlingStrategy":"fallback","validationCode":"// Verify completion by hash lookup before trusting poll failure\nif _, err := d.getFileByHash(ctx, expectedHash); err == nil {\n    return completed // upload actually landed\n}","typeGuard":null,"tryCatchPattern":"// On 'invalid key' results, verify-by-hash fallback\npoll, err := d.pollUpload(ctx, key)\nif err != nil && strings.Contains(strings.ToLower(err.Error()), \"key\") {\n    if _, herr := d.getFileByHash(ctx, hash); herr == nil {\n        return nil // treat as success; file exists\n    }\n    return err\n}","preventionTips":["Always verify by hash after poll failures — server state may be complete","Re-run uploadCheck to restart from the bitmap when keys expire","Don't discard poll keys on transient errors"],"tags":["mediafire","polling","upload","api-error","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}