{"record":{"id":"74783b5bad16e053","repo":"nextcloud/server","slug":"destination-is-not-a-folder","errorCode":null,"errorMessage":"Destination is not a folder","messagePattern":"Destination is not a folder","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/files/src/actions/moveOrCopyAction.ts","lineNumber":104,"sourceCode":"}\n\n/**\n * Handle the copy/move of a node to a destination\n * This can be imported and used by other scripts/components on server\n *\n * @param nodes The nodes to copy/move\n * @param destination The destination to copy/move the nodes to\n * @param method The method to use for the copy/move\n * @param overwrite Whether to overwrite the destination if it exists\n * @yields {AsyncGenerator<void, void, never>} A promise that resolves when the copy/move is done\n */\nexport async function* handleCopyMoveNodesTo(nodes: INode[], destination: IFolder, method: MoveCopyAction.COPY | MoveCopyAction.MOVE, overwrite = false): AsyncGenerator<void, void, never> {\n\tif (!destination) {\n\t\treturn\n\t}\n\n\tif (destination.type !== FileType.Folder) {\n\t\tthrow new Error(t('files', 'Destination is not a folder'))\n\t}\n\n\t// Do not allow to MOVE a node to the same folder it is already located\n\tif (method === MoveCopyAction.MOVE && nodes.some((node) => node.dirname === destination.path)) {\n\t\tthrow new Error(t('files', 'This file/folder is already in that directory'))\n\t}\n\n\t/**\n\t * Example:\n\t * - node: /foo/bar/file.txt -> path = /foo/bar/file.txt, destination: /foo\n\t *   Allow move of /foo does not start with /foo/bar/file.txt so allow\n\t * - node: /foo , destination: /foo/bar\n\t *   Do not allow as it would copy foo within itself\n\t * - node: /foo/bar.txt, destination: /foo\n\t *   Allow copy a file to the same directory\n\t * - node: \"/foo/bar\", destination: \"/foo/bar 1\"\n\t *   Allow to move or copy but we need to check with trailing / otherwise it would report false positive\n\t */","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/files/src/actions/moveOrCopyAction.ts#L86-L122","documentation":"Error \"Destination is not a folder\" thrown in nextcloud/server.","triggerScenarios":"Thrown at apps/files/src/actions/moveOrCopyAction.ts:104 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":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}