AlistGo/alist · error

MediaFire poll upload failed: %s

Error message

MediaFire poll upload failed: %s

What it means

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).

Source

Thrown at drivers/mediafire/util.go:562

	query := map[string]string{
		"key":             key,
		"response_format": "json",
		"session_token":   actionToken, /* d.SessionToken */
	}

	var resp MediafirePollResponse
	_, err = d.postForm("/upload/poll_upload.php", query, &resp)
	if err != nil {
		return nil, err
	}

	//fmt.Printf("pollUpload :: Raw response: %s\n", string(body))
	//fmt.Printf("pollUpload :: Parsed response: %+v\n", resp)

	//fmt.Printf("pollUpload :: Debug Result: %+v\n", resp.Response.Result)

	if resp.Response.Result != "Success" {
		return nil, fmt.Errorf("MediaFire poll upload failed: %s", resp.Response.Result)
	}

	return &resp, nil
}

func (d *Mediafire) sha256Hex(r io.Reader) string {
	h := sha256.New()
	io.Copy(h, r)
	return hex.EncodeToString(h.Sum(nil))
}

func (d *Mediafire) isUnitUploaded(words []int, unitID int) bool {
	wordIndex := unitID / 16
	bitIndex := unitID % 16
	if wordIndex >= len(words) {
		return false
	}
	return (words[wordIndex]>>bitIndex)&1 == 1

View on GitHub (pinned to 843d9dc814)

Solutions

  1. 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
  2. Verify the file on MediaFire by listing the destination folder — the upload may have completed despite the poll failure (defensive dedup by hash)
  3. Retry polling a few times with delay before declaring failure; transient result errors occur during assembly
  4. If hash mismatch is indicated, recompute SHA-256 and re-upload from scratch

Example fix

// before
if resp.Response.Result != "Success" {
    return nil, fmt.Errorf("MediaFire poll upload failed: %s", resp.Response.Result)
}

// after
if resp.Response.Result != "Success" {
    if strings.Contains(strings.ToLower(resp.Response.Result), "key") {
        // upload key expired/unknown: check if file actually landed
        if _, err := d.getFileByHash(ctx, fileHash); err == nil {
            return nil, nil // treat as completed; caller verifies by hash
        }
    }
    return nil, fmt.Errorf("MediaFire poll upload failed: %s", resp.Response.Result)
}
Defensive patterns

Strategy: fallback

Validate before calling

// Verify completion by hash lookup before trusting poll failure
if _, err := d.getFileByHash(ctx, expectedHash); err == nil {
    return completed // upload actually landed
}

Try / catch

// On 'invalid key' results, verify-by-hash fallback
poll, err := d.pollUpload(ctx, key)
if err != nil && strings.Contains(strings.ToLower(err.Error()), "key") {
    if _, herr := d.getFileByHash(ctx, hash); herr == nil {
        return nil // treat as success; file exists
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/2ad0570dae4688b1. Report an issue: GitHub.