yorukot/superfile · error

cannot paste into parent directory of source, srcPath : %v,

Error message

cannot paste into parent directory of source, srcPath : %v, panelLocation : %v

What it means

Error "cannot paste into parent directory of source, srcPath : %v, panelLocation : %v" thrown in yorukot/superfile.

Source

Thrown at src/internal/handle_file_operations.go:297

	slog.Debug("Submitting pasteItems request", "id", reqID, "items cnt", len(copyItems), "dest", panelLocation)
	return func() tea.Msg {
		err := validatePasteOperation(panelLocation, copyItems, cut)
		if err != nil {
			return NewNotifyModalMsg(notify.New(true, "Invalid paste location", err.Error(), notify.NoAction),
				reqID)
		}
		return m.executePasteOperation(&m.processBarModel, panelLocation, copyItems, cut, reqID)
	}
}

func validatePasteOperation(panelLocation string, copyItems []string, cut bool) error {
	// Check if trying to paste into source or subdirectory for both cut and copy operations
	for _, srcPath := range copyItems {
		// Check if trying to cut and paste into the same directory - this would be a no-op
		// and could potentially cause issues, so we prevent it
		if filepath.Dir(srcPath) == panelLocation && cut {
			return fmt.Errorf("cannot paste into parent directory of source, srcPath : %v, panelLocation : %v",
				srcPath, panelLocation)
		}
		if cut && srcPath == panelLocation {
			return errors.New("cannot paste a directory into itself")
		}

		if isAncestor(srcPath, panelLocation) {
			return fmt.Errorf("cannot %s and paste a directory into itself or its subdirectory",
				getCopyOrCutOperationName(cut))
		}
	}

	return nil
}

func makePasteProcessor(process processbar.Process,
	processBarModel *processbar.Model,
	panelLocation string, cut bool,

View on GitHub (pinned to b72f550bc6)

When it happens

Trigger: Thrown at src/internal/handle_file_operations.go:297 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of yorukot/superfile@b72f550bc6 (2026-09-01). Data as JSON: /api/errors/9d55e12cbc94a02d. Report an issue: GitHub.