{"record":{"id":"9eada7c47825416b","repo":"octobercms/october","slug":"editor-lang-filesystem-error-moving-file","errorCode":null,"errorMessage":"editor::lang.filesystem.error_moving_file","messagePattern":"editor::lang\\.filesystem\\.error_moving_file","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/editor/traits/FileSystemFunctions.php","lineNumber":210,"sourceCode":"            $originalFullPath = $basePath.'/'.$path;\n            $newFullPath = rtrim($destinationFullPath, '/').'/'.$basename;\n            $safeDir = $basePath;\n\n            if ($originalFullPath == $newFullPath) {\n                continue;\n            }\n\n            if ((is_file($originalFullPath) && is_file($newFullPath))\n                || (is_dir($originalFullPath) && is_dir($newFullPath))) {\n                throw new ApplicationException(Lang::get(\n                    'editor::lang.filesystem.destination_exists',\n                    ['name' => $basename]\n                ));\n            }\n\n            if (is_file($originalFullPath)) {\n                if (!@File::move($originalFullPath, $newFullPath)) {\n                    throw new ApplicationException(Lang::get(\n                        'editor::lang.filesystem.error_moving_file',\n                        ['file' => $basename]\n                    ));\n                }\n            }\n            elseif (is_dir($originalFullPath)) {\n                if (!@File::copyDirectory($originalFullPath, $newFullPath)) {\n                    throw new ApplicationException(Lang::get(\n                        'editor::lang.filesystem.error_moving_directory',\n                        ['dir' => $basename]\n                    ));\n                }\n\n                if (strpos($originalFullPath, '../') !== false) {\n                    throw new ApplicationException(Lang::get(\n                        'editor::lang.filesystem.error_deleting_directory',\n                        ['dir' => $basename]\n                    ));","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/editor/traits/FileSystemFunctions.php#L192-L228","documentation":"Thrown by editorMoveFilesOrDirectories when @File::move() returns false for a regular file (lines 208-214). Message: 'Error moving file :file'. All preconditions passed, so this is an OS-level failure: the PHP user cannot write the destination directory (or rename across devices where applicable), the source file is locked, or a mount prevents the operation.","triggerScenarios":"command_onAssetMove where the destination directory was auto-created with 0755 by a process other than the webserver user, or a pre-existing destination folder with restrictive ownership; Windows locked source file; read-only destination mount.","commonSituations":"Destination subfolders created by root deploys; permission drift between theme subdirectories; containerized setups with mixed volume ownership; source asset open in another program on Windows.","solutions":["chown/chmod the destination directory so the PHP user can write (move needs write on the target dir)","Verify the source file is not locked (close editors/lsof) and the volume is read-write","Retry after fixing permissions — the failing file has not been moved, earlier files in the batch may have","Check whether a partial batch already moved some files; reconcile before re-running"],"exampleFix":"# before: destination dir root-owned\n$ sudo chown -R www-data:www-data themes/demo/assets/img\n# retry the move in the Editor","handlingStrategy":"try-catch","validationCode":"$newFullPath = rtrim($destinationFullPath, '/').'/'.basename($path);\nif (!is_writable($destinationFullPath) || !is_writable($assetsBase.'/'.$path)) {\n    // File::move needs write on both directory entries — fix perms first\n}","typeGuard":null,"tryCatchPattern":"use October\\Rain\\Exception\\ApplicationException;\n\ntry {\n    if (!@File::move($originalFullPath, $newFullPath)) {\n        throw new ApplicationException(Lang::get('editor::lang.filesystem.error_moving_file', ['file' => $basename]));\n    }\n} catch (ApplicationException $e) {\n    Log::warning('asset move failed', ['file' => $basename]);\n    throw $e; // UI shows the localized message; earlier batch items already moved\n}","preventionTips":["Ensure destination directories (including auto-created ones) are writable by the PHP user","Close programs holding source files open (Windows) before moving","Track batch state so partially-moved batches can be reconciled after a failure"],"tags":["filesystem","permissions","io","editor","winter-cms"],"backgroundTag":"filesystem-permission-denied","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}