AlistGo/alist · error

failed to find destination: %w

Error message

failed to find destination: %w

What it means

DirectMove failed to resolve the destination directory's path to a link. The '/' shortcut maps to d.RootLink, so this fires only for non-root destinations whose path cannot be walked (missing folder, deleted, or not actually a folder — searchByPath is called with isFolder=true).

Source

Thrown at drivers/proton_drive/util.go:746

	return nil
}

func (d *ProtonDrive) DirectMove(ctx context.Context, srcObj model.Obj, dstDir model.Obj) (model.Obj, error) {
	//fmt.Printf("DEBUG DirectMove: srcPath=%s, dstPath=%s", srcObj.GetPath(), dstDir.GetPath())

	srcLink, err := d.searchByPath(ctx, srcObj.GetPath(), srcObj.IsDir())
	if err != nil {
		return nil, fmt.Errorf("failed to find source: %w", err)
	}

	var dstParentLinkID string
	if dstDir.GetPath() == "/" {
		dstParentLinkID = d.RootLink.LinkID
	} else {
		dstLink, err := d.searchByPath(ctx, dstDir.GetPath(), true)
		if err != nil {
			return nil, fmt.Errorf("failed to find destination: %w", err)
		}
		dstParentLinkID = dstLink.LinkID
	}

	if srcObj.IsDir() {

		// Check if destination is a descendant of source
		if err := d.checkCircularMove(ctx, srcLink.LinkID, dstParentLinkID); err != nil {
			return nil, err
		}
	}

	// Encrypt the filename for the new location
	encryptedName, err := d.encryptFileName(ctx, srcObj.GetName(), dstParentLinkID)
	if err != nil {
		return nil, fmt.Errorf("failed to encrypt filename: %w", err)
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-list the destination directory before the move to confirm it exists and is a folder
  2. Surface a 'destination not found' error and let the UI refresh the tree
  3. Verify the destination is not itself the file being moved
Defensive patterns

Strategy: validation

Validate before calling

dstObj, err := d.get(ctx, dstDir.GetPath())
if err != nil { return fmt.Errorf("destination missing: %w", err) }
if !dstObj.IsDir() { return fmt.Errorf("destination is not a folder") }

Try / catch

if err := d.DirectMove(ctx, src, dst); err != nil {
    if strings.Contains(err.Error(), "failed to find destination") {
        refreshTree(dstDir.GetPath()); // user re-selects folder
    }
}

Prevention

When it happens

Trigger: Destination folder deleted between selection and move; destination path belonging to a file; destination inside a share the mount cannot decrypt; wrong path casing or separators.

Common situations: Drag-drop into a folder that vanished after a sync; stale directory listings in the client; moving into shared folders with undecryptable keys for this account.

Related errors


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