AlistGo/alist · error

same-name dirs cannot be moved to

Error message

same-name dirs cannot be moved to

What it means

Returned by Alias.Move when the DESTINATION directory cannot be uniquely resolved: getReqPath on dstDir fails with errs.NotImplement because ProtectSameName is on and the destination folder exists in multiple destinations mapped under the same alias key. The move source was resolvable; the target was not.

Source

Thrown at drivers/alias/driver.go:157

		return errors.New("same-name dirs cannot make sub-dir")
	}
	return err
}

func (d *Alias) Move(ctx context.Context, srcObj, dstDir model.Obj) error {
	if !d.Writable {
		return errs.PermissionDenied
	}
	srcPath, err := d.getReqPath(ctx, srcObj, false)
	if errs.IsNotImplement(err) {
		return errors.New("same-name files cannot be moved")
	}
	if err != nil {
		return err
	}
	dstPath, err := d.getReqPath(ctx, dstDir, true)
	if errs.IsNotImplement(err) {
		return errors.New("same-name dirs cannot be moved to")
	}
	if err != nil {
		return err
	}
	return fs.Move(ctx, *srcPath, *dstPath)
}

func (d *Alias) Rename(ctx context.Context, srcObj model.Obj, newName string) error {
	if !d.Writable {
		return errs.PermissionDenied
	}
	reqPath, err := d.getReqPath(ctx, srcObj, false)
	if err == nil {
		return fs.Rename(ctx, *reqPath, newName)
	}
	if errs.IsNotImplement(err) {
		return errors.New("same-name files cannot be Rename")
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Target a concrete destination by using a uniquely-keyed alias or the underlying mount path
  2. Disable ProtectSameName to let the first resolved destination win (risky for mirrored data)
  3. Keep merged mounts read-only (Writable=false) and write only through single-destination mounts
  4. Remove the duplicate destination folder so only one candidate resolves

Example fix

# before — 'inbox' maps to two storages, both contain /
inbox: /netdisk_a/inbox
inbox: /netdisk_b/inbox

# after — write path is unique
inbox_a: /netdisk_a/inbox
inbox_b: /netdisk_b/inbox
Defensive patterns

Strategy: validation

Validate before calling

// Verify the destination resolves uniquely before the move
if len(d.pathMap[rootOf(dstPath)]) > 1 && d.ProtectSameName {
    return errors.New("destination mirrored; pick a single-backend target")
}

Type guard

// Go
func isSameNameErr(err error) bool {
    return err != nil && strings.Contains(err.Error(), "same-name")
}

Try / catch

if err := d.Move(ctx, src, dst); isSameNameErr(err) {
    // re-target a unique key or concrete mount, then retry once
} else if err != nil { return err }

Prevention

When it happens

Trigger: ProtectSameName=true; dstDir's alias key maps to multiple Paths entries; the destination folder exists in two or more of those underlying locations; Move is called with that dir as target.

Common situations: Moving files into a merged 'inbox' alias backed by two storages where the inbox folder already exists in both; mirrors kept in sync so both copies always exist, making every write into them ambiguous.

Related errors


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