AlistGo/alist · warning
existing file not found
Error message
existing file not found
What it means
A linear scan of the folder listing completed without any non-folder entry whose Name equals the requested filename. This is a lookup-miss on an exact, case-sensitive name match, used to find an existing file (typically before upload to decide update-vs-create). The folder itself was listed successfully; the file simply is not there under that exact name.
Source
Thrown at drivers/mediafire/util.go:600
func (d *Mediafire) getExistingFileInfo(ctx context.Context, fileHash, filename, folderKey string) (*model.ObjThumb, error) {
if fileInfo, err := d.getFileByHash(ctx, fileHash); err == nil && fileInfo != nil {
return fileInfo, nil
}
files, err := d.getFiles(ctx, folderKey)
if err != nil {
return nil, err
}
for _, file := range files {
if file.Name == filename && !file.IsFolder {
return d.fileToObj(file), nil
}
}
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)
}View on GitHub (pinned to 843d9dc814)
Solutions
- Treat as not-found and proceed with create/new-upload logic rather than erroring — this is a normal miss in find-or-create flows
- If the file should exist, list the folder and compare names byte-for-byte (check case and Unicode normalization)
- Confirm the correct folderKey is being scanned
- Check MediaFire trash — deleted files are absent from folder listings
Example fix
// before
for _, file := range files {
if file.Name == filename && !file.IsFolder {
return d.fileToObj(file), nil
}
}
return nil, fmt.Errorf("existing file not found")
// after (caller treats not-found as non-fatal)
existing, err := d.findExisting(ctx, folderKey, filename)
if err != nil {
if strings.Contains(err.Error(), "existing file not found") {
existing = nil // proceed with fresh upload
} else {
return err
}
} Defensive patterns
Strategy: validation
Validate before calling
// Normalize before comparing names
want := strings.TrimSpace(filename)
for _, f := range files {
if !f.IsFolder && norm.NFC.String(f.Name) == norm.NFC.String(want) {
return d.fileToObj(f), nil
}
} Try / catch
// find-or-create: not-found is a branch, not a failure
existing, err := d.findExisting(ctx, folder, name)
if err != nil && strings.Contains(err.Error(), "existing file not found") {
existing = nil
} else if err != nil {
return err
} Prevention
- Treat this error as the normal miss in upload flows
- Use Unicode NFC normalization and exact-case comparison consciously
- Scan the right folderKey; check trash for 'missing' files
When it happens
Trigger: First upload of a file with this name (expected miss); filename differs by case, trailing space, or Unicode normalization; file in a subfolder rather than the scanned folder; listing pagination missing entries; file deleted between operations.
Common situations: Upload flows calling findExisting before Put; case-sensitivity surprises when the file was created with different casing on another OS; NFD vs NFC Unicode names from macOS clients; files moved to trash and thus excluded from the listing.
Related errors
- file not found by hash
- expected *os.File, got %T
- no download links found
- failed to get action token: %w
- MediaFire upload check failed: %s
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/682c68cbc9004d0a.
Report an issue: GitHub.