AlistGo/alist · error
copy merge file %s: %w
Error message
copy merge file %s: %w
What it means
During a copy-merge in the SJTU driver, copying one child FILE (a direct PUT /file/... with copyFrom and "overwrite" strategy) returned a transport-level error. The message names the file. Because conflicts are overwritten, any failure here is an API/transport problem, not a name clash.
Source
Thrown at drivers/sjtu_netdisk/driver.go:527
childObj := &model.Object{
Name: child.GetName(),
Path: childSrcPath,
Size: child.GetSize(),
IsFolder: true,
}
if _, mergeErr := d.Copy(ctx, childObj, targetDirObj); mergeErr != nil {
return nil, fmt.Errorf("copy merge subfolder %s: %w", child.GetName(), mergeErr)
}
} else {
childEncoded := d.encodePath(path.Join(targetPath, child.GetName()))
childURL := fmt.Sprintf("%s/file/%s/%s/%s", API_URL, d.libraryId, d.spaceId, childEncoded)
if _, fileErr := d.newClient().R().
SetContext(ctx).
SetQueryParam("access_token", d.accessToken).
SetQueryParam("conflict_resolution_strategy", "overwrite").
SetBody(map[string]interface{}{"copyFrom": childSrcPath}).
Execute(http.MethodPut, childURL); fileErr != nil {
return nil, fmt.Errorf("copy merge file %s: %w", child.GetName(), fileErr)
}
}
}
return &model.Object{
Name: srcObj.GetName(),
Size: srcObj.GetSize(),
IsFolder: true,
Modified: srcObj.ModTime(),
Ctime: time.Now(),
Path: targetPath,
}, nil
}
// 202 Accepted:polling task status
if resp.StatusCode() != http.StatusAccepted {
return nil, fmt.Errorf("unexpected copy folder response: status=%d", resp.StatusCode())
}View on GitHub (pinned to 843d9dc814)
Solutions
- Retry the parent copy — overwrite semantics make retries safe
- Address the wrapped transport error (network, auth) first
- Copy the named file alone to confirm it succeeds
- Reduce batch size or add delay between large copies if throttled
Defensive patterns
Strategy: retry
Try / catch
if err != nil && strings.Contains(err.Error(), "copy merge file") {
f := extractFileName(err)
return copySingleFile(ctx, f) // 'overwrite' makes retries safe
} Prevention
- Retry the named file — overwrite semantics are idempotent
- Stabilize network before bulk copies
- Throttle large copies to avoid server-side rate limits
When it happens
Trigger: Copy folder onto an existing name; the per-file copy PUT fails (expired token, 5xx, connection reset during bulk operations).
Common situations: Bulk copies where one file failure aborts everything; network instability; server-side throttling during many rapid PUTs.
Related errors
- merge file %s: %w
- rename merge file %s: %w
- copy merge: list source folder failed: %w
- copy merge subfolder %s: %w
- merge: list source folder failed: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/5cbdb78eb4ecf7ad.
Report an issue: GitHub.