AlistGo/alist · error

copy merge: list source folder failed: %w

Error message

copy merge: list source folder failed: %w

What it means

During a folder Copy that got 409 (target name exists), the SJTU driver merges by copying each child. This error means the List call to enumerate the source children failed, aborting the copy-merge before any child was copied. The wrapped error is the real List failure.

Source

Thrown at drivers/sjtu_netdisk/driver.go:496

	} else {
		// folder copy
		infoURL := fmt.Sprintf("%s/directory/%s/%s/%s", API_URL, d.libraryId, d.spaceId, d.encodePath(targetPath))

		resp, err := d.newClient().R().
			SetContext(ctx).
			SetQueryParam("access_token", d.accessToken).
			SetQueryParam("conflict_resolution_strategy", "ask").
			SetBody(map[string]interface{}{"copyFrom": srcPath}).
			Execute(http.MethodPut, infoURL)

		if err != nil {
			return nil, err
		}

		if resp.StatusCode() == http.StatusConflict {
			children, listErr := d.List(ctx, srcObj, model.ListArgs{})
			if listErr != nil {
				return nil, fmt.Errorf("copy merge: list source folder failed: %w", listErr)
			}

			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,
					}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Inspect the wrapped error for the root cause
  2. Confirm the source folder still exists and lists in the AList UI, then retry
  3. Avoid concurrent modifications of the source while copying
  4. For huge folders, copy subfolders individually
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "copy merge: list source folder failed") {
    refreshDir(srcParent)
    return retryCopyOnce()
}

Prevention

When it happens

Trigger: Copy folder onto an existing folder of the same name; the subsequent d.List(ctx, srcObj) errors (expired token, source removed mid-copy, transient failure).

Common situations: Source folder deleted or moved by another client during the copy; token expiry mid-operation; very large source folders timing out on listing.

Related errors


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