AlistGo/alist · error

copy merge subfolder %s: %w

Error message

copy merge subfolder %s: %w

What it means

During a copy-merge in the SJTU driver, recursively copying one child subfolder into the target failed. The message names the subfolder; the wrapped error is the recursive Copy failure (auth, 5xx, or deeper merge error).

Source

Thrown at drivers/sjtu_netdisk/driver.go:516

			targetDirObj := &model.Object{
				Path:     targetPath,
				Name:     srcObj.GetName(),
				IsFolder: true,
			}

			for _, child := range children {
				childSrcPath := path.Join(srcPath, child.GetName())

				if child.IsDir() {
					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(),

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry the copy of the named subfolder in isolation
  2. Check the wrapped error (auth, quota, permission) and remediate
  3. Verify quota on the destination space before copying large trees
  4. Split large copies into per-subfolder operations
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "copy merge subfolder") {
    sub := extractSubfolderName(err)
    return copySingleSubfolder(ctx, sub) // resumes the merge
}

Prevention

When it happens

Trigger: Copy folder onto an existing name triggers the merge loop; d.Copy(childObj, targetDirObj) errors for one subfolder.

Common situations: Deep trees where one failing branch aborts the entire copy; token expiry during long copies; destination quota exceeded partway.

Related errors


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