AlistGo/alist · error

merge subfolder %s: %w

Error message

merge subfolder %s: %w

What it means

During a merge-move in the SJTU driver, a child subfolder's recursive d.Move() returned an error (e.g. auth failure, API 5xx, or nested merge failure). The message names the failing subfolder so the merge can be resumed from it. This is the error path for recursive Move failures, distinct from 1026 which covers the moveItem call itself.

Source

Thrown at drivers/sjtu_netdisk/driver.go:304

			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{
						Path:     targetPath,
						Name:     srcObj.GetName(),
						IsFolder: true,
					})
					if mergeErr != nil {
						return nil, fmt.Errorf("merge subfolder %s: %w", child.GetName(), mergeErr)
					}
				} else if childErr != nil {
					return nil, fmt.Errorf("merge subfolder %s: %w", child.GetName(), childErr)
				}
			} else {
				// child item is file
				fileErr := d.moveItem(ctx, childSrcPath, targetDstPath, child.GetName(), false, "overwrite")
				if fileErr != nil {
					return nil, fmt.Errorf("merge file %s: %w", child.GetName(), fileErr)
				}
			}
		}

		// delete empty srcObj folder
		_ = d.Remove(ctx, srcObj)

		return &model.Object{
			Name:     srcObj.GetName(),

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Note the subfolder name in the message — retry the move of just that subfolder
  2. Check the underlying error for auth or 404 causes and fix those first
  3. For very large trees, move subfolders individually so one failure does not abort everything
  4. Verify the destination state after a failure (some children may already be moved) before retrying
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "merge subfolder") {
    sub := extractSubfolderName(err) // from the %s in the message
    return moveSingleSubfolder(ctx, sub) // resume from the failed branch
}

Prevention

When it happens

Trigger: Move folder over an existing folder with the same name; one nested subfolder fails its recursive Move due to expired token, server error, or a nested name conflict that itself errors.

Common situations: Deep directory trees where any single nested failure aborts the whole merge; token expiring mid-operation on large trees; partial server-side state left from a previous failed merge.

Related errors


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