AlistGo/alist · error

merge: list source folder failed: %w

Error message

merge: list source folder failed: %w

What it means

During a Move that hits a name conflict (409), the SJTU driver merges by recursively moving each child of the source folder. This error means the List call needed to enumerate those children itself failed, so the merge could not even start. The wrapped error carries the actual List failure.

Source

Thrown at drivers/sjtu_netdisk/driver.go:280

			return &model.Object{
				Name:     srcObj.GetName(),
				Size:     srcObj.GetSize(),
				IsFolder: true,
				Modified: srcObj.ModTime(),
				Ctime:    srcObj.CreateTime(),
				Path:     targetPath,
			}, nil
		}

		// 409 means conflict name, needs merge
		if !errors.Is(err, errs.ObjectNotFound) {
			return nil, err
		}

		// list all child item of srcObj
		children, listErr := d.List(ctx, srcObj, model.ListArgs{})
		if listErr != nil {
			return nil, fmt.Errorf("merge: list source folder failed: %w", listErr)
		}

		// move every child item to dstDir recursively
		for _, child := range children {
			childSrcPath := path.Join(srcPath, child.GetName())
			targetDstPath := targetPath

			// subfolder: recursive Move
			if child.IsDir() {
				childErr := d.moveItem(ctx, childSrcPath, targetDstPath, child.GetName(), true, "ask")
				if childErr != nil && errors.Is(childErr, errs.ObjectNotFound) {
					childObj := &model.Object{
						Name:     child.GetName(),
						Path:     childSrcPath,
						Size:     child.GetSize(),
						IsFolder: true,
					}
					_, mergeErr := d.Move(ctx, childObj, &model.Object{

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Inspect the wrapped error (%w) — it is the real cause (auth, 404, timeout)
  2. Retry the move after confirming the source folder still lists correctly in the AList UI
  3. Avoid concurrent moves/renames of the same tree from two clients
  4. If the source is gone, refresh the parent directory and drop the stale entry
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "merge: list source folder failed") {
    // source may be stale; re-list parent, then retry the move once
    refreshDir(srcParent)
    return retryMoveOnce()
}

Prevention

When it happens

Trigger: Move folder A into a location already containing A triggers the merge path; the subsequent d.List(ctx, srcObj) fails due to an expired token, the source folder being deleted mid-operation, or a transient API error.

Common situations: Concurrent modification (another client moved/deleted the source folder); token expiry racing the second API call; moving very large folders where the API times out on listing; the source path containing characters that break the listing URL.

Related errors


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