AlistGo/alist · error
MediaFire file search failed: %s
Error message
MediaFire file search failed: %s
What it means
The /file/get_info.php lookup by hash returned Result != Success when queried with a file hash. MediaFire refused the hash-based file info request — most commonly because no file with that hash exists in the account, which this endpoint reports as a non-Success result rather than an empty list.
Source
Thrown at drivers/mediafire/util.go:617
return nil, fmt.Errorf("existing file not found")
}
func (d *Mediafire) getFileByHash(_ context.Context, hash string) (*model.ObjThumb, error) {
query := map[string]string{
"session_token": d.SessionToken,
"response_format": "json",
"hash": hash,
}
var resp MediafireFileSearchResponse
_, err := d.postForm("/file/get_info.php", query, &resp)
if err != nil {
return nil, err
}
if resp.Response.Result != "Success" {
return nil, fmt.Errorf("MediaFire file search failed: %s", resp.Response.Result)
}
if len(resp.Response.FileInfo) == 0 {
return nil, fmt.Errorf("file not found by hash")
}
file := resp.Response.FileInfo[0]
return d.fileToObj(file), nil
}
View on GitHub (pinned to 843d9dc814)
Solutions
- Check the embedded result string; hash-not-found results should map to a clean not-found error, not a generic failure
- Validate the hash format (lowercase hex SHA-256, 64 chars) before calling
- Re-login if the result indicates a session problem
- If used for dedup, treat not-found as 'needs full upload'
Example fix
// before
if resp.Response.Result != "Success" {
return nil, fmt.Errorf("MediaFire file search failed: %s", resp.Response.Result)
}
// after
if resp.Response.Result != "Success" {
if strings.Contains(strings.ToLower(resp.Response.Result), "not found") || strings.Contains(strings.ToLower(resp.Response.Result), "invalid hash") {
return nil, errs.ObjectNotFound
}
return nil, fmt.Errorf("MediaFire file search failed: %s", resp.Response.Result)
} Defensive patterns
Strategy: validation
Validate before calling
// Validate hash shape before the call
if len(hash) != 64 { return errors.New("hash must be 64 hex chars") }
if _, err := hex.DecodeString(hash); err != nil { return fmt.Errorf("invalid hex hash: %w", err) } Try / catch
// Map not-found results to a typed error
obj, err := d.getFileByHash(ctx, hash)
if err != nil {
if strings.Contains(strings.ToLower(err.Error()), "not found") {
return nil, errs.ObjectNotFound
}
return nil, err
} Prevention
- Normalize hash to lowercase hex before querying
- Treat not-found as expected in dedup flows, not as a bug
- Re-login when results look session-related
When it happens
Trigger: Searching for a hash that was never uploaded to this account; hash of a file uploaded to a different account; malformed hash string (wrong length/case for the expected hex format); session token invalid at query time.
Common situations: Instant-upload / dedup-by-hash checks where the file is genuinely new; verifying after a poll failure whether the file landed; copying hashes from another account or tool with a different hash scheme; stale sessions in long-running daemons.
Related errors
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/0215b2553bbb8887.
Report an issue: GitHub.