yorukot/superfile · error

cannot %s and paste a directory into itself or its subdirect

Error message

cannot %s and paste a directory into itself or its subdirectory

What it means

Error "cannot %s and paste a directory into itself or its subdirectory" thrown in yorukot/superfile.

Source

Thrown at src/internal/handle_file_operations.go:305

		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,
) processbar.FileListProcessor {
	processorFunction := func(items []string) (processbar.Process, []string) {
		notProcessed := make([]string, 0)
		if len(items) == 0 {
			markProcessDone(process, processBarModel)
			return process, notProcessed
		}
		var err error

View on GitHub (pinned to b72f550bc6)

When it happens

Trigger: Thrown at src/internal/handle_file_operations.go:305 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/d222c6bbffafe54a. Report an issue: GitHub.