{"record":{"id":"d222c6bbffafe54a","repo":"yorukot/superfile","slug":"cannot-s-and-paste-a-directory-into-itself-or-its","errorCode":null,"errorMessage":"cannot %s and paste a directory into itself or its subdirectory","messagePattern":"cannot (.+?) and paste a directory into itself or its subdirectory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/internal/handle_file_operations.go","lineNumber":305,"sourceCode":"\t\treturn m.executePasteOperation(&m.processBarModel, panelLocation, copyItems, cut, reqID)\n\t}\n}\n\nfunc validatePasteOperation(panelLocation string, copyItems []string, cut bool) error {\n\t// Check if trying to paste into source or subdirectory for both cut and copy operations\n\tfor _, srcPath := range copyItems {\n\t\t// Check if trying to cut and paste into the same directory - this would be a no-op\n\t\t// and could potentially cause issues, so we prevent it\n\t\tif filepath.Dir(srcPath) == panelLocation && cut {\n\t\t\treturn fmt.Errorf(\"cannot paste into parent directory of source, srcPath : %v, panelLocation : %v\",\n\t\t\t\tsrcPath, panelLocation)\n\t\t}\n\t\tif cut && srcPath == panelLocation {\n\t\t\treturn errors.New(\"cannot paste a directory into itself\")\n\t\t}\n\n\t\tif isAncestor(srcPath, panelLocation) {\n\t\t\treturn fmt.Errorf(\"cannot %s and paste a directory into itself or its subdirectory\",\n\t\t\t\tgetCopyOrCutOperationName(cut))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc makePasteProcessor(process processbar.Process,\n\tprocessBarModel *processbar.Model,\n\tpanelLocation string, cut bool,\n) processbar.FileListProcessor {\n\tprocessorFunction := func(items []string) (processbar.Process, []string) {\n\t\tnotProcessed := make([]string, 0)\n\t\tif len(items) == 0 {\n\t\t\tmarkProcessDone(process, processBarModel)\n\t\t\treturn process, notProcessed\n\t\t}\n\t\tvar err error","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/yorukot/superfile/blob/b72f550bc6e75913f48eb49fdd258e1a2df2fe88/src/internal/handle_file_operations.go#L287-L323","documentation":"Error \"cannot %s and paste a directory into itself or its subdirectory\" thrown in yorukot/superfile.","triggerScenarios":"Thrown at src/internal/handle_file_operations.go:305 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b72f550bc6e75913f48eb49fdd258e1a2df2fe88","analyzedAt":"2026-09-01T04:38:08.254Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}