AlistGo/alist · error

MediaFire upload check failed: %s

Error message

MediaFire upload check failed: %s

What it means

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.

Source

Thrown at drivers/mediafire/util.go:375

		"folder_key":      folderKey,
		"resumable":       "yes",
		"response_format": "json",
	}

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

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

	//fmt.Printf("uploadCheck :: ResumableUpload section: %+v\n", resp.Response.ResumableUpload)
	//fmt.Printf("uploadCheck :: Upload key specifically: '%s'\n", resp.Response.ResumableUpload.UploadKey)

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

	return &resp, nil
}

func (d *Mediafire) resumableUpload(ctx context.Context, folderKey, uploadKey string, unitData []byte, unitID int, fileHash, filename string, totalFileSize int64) (string, error) {
	actionToken, err := d.getActionToken(ctx)
	if err != nil {
		return "", err
	}

	url := d.apiBase + "/upload/resumable.php"
	req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(unitData))
	if err != nil {
		return "", err
	}

	q := req.URL.Query()

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Read the embedded result string — it names the exact refusal reason (e.g. "Invalid folder_key", "Storage quota exceeded")
  2. Verify folder_key by listing the parent folder before upload
  3. Confirm the hash passed in is a lowercase hex SHA-256 of the full file and the size matches os.Stat
  4. Free space or upgrade the account if quota is the cause; re-login if the message indicates an auth problem

Example fix

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

// after
if resp.Response.Result != "Success" {
    if strings.Contains(resp.Response.Result, "folder") {
        return nil, fmt.Errorf("MediaFire upload check failed (bad folder_key %s): %s", folderKey, resp.Response.Result)
    }
    return nil, fmt.Errorf("MediaFire upload check failed: %s", resp.Response.Result)
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate upload inputs before hitting check.php
if folderKey == "" { return errors.New("folder_key required") }
if filesize <= 0 { return errors.New("invalid file size") }
if len(filehash) != 64 { return errors.New("hash must be 64-char hex SHA-256") }
if _, err := hex.DecodeString(filehash); err != nil { return fmt.Errorf("bad hash: %w", err) }

Try / catch

// Treat folder/quota results as permanent, others as retriable
if err := uploadCheck(...); err != nil {
    msg := err.Error()
    switch {
    case strings.Contains(msg, "folder"), strings.Contains(msg, "quota"):
        return err // permanent: fix config or space
    default:
        return retryAfter(time.Second, func() error { return uploadCheck(...) })
    }
}

Prevention

When it happens

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

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

Related errors


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