octobercms/october · error · ApplicationException

editor::lang.filesystem.destination_not_found

Error message

editor::lang.filesystem.destination_not_found

What it means

Thrown by editorMoveFilesOrDirectories when, after attempting File::makeDirectory($destinationFullPath, 0755, true, true), the destination still is not an existing directory (lines 176-184). Message: 'Destination directory is not found'. Since the code just tried to create it, the usual causes are: a regular FILE occupies that path (mkdir fails), the base path is unwritable so mkdir failed, or the base path itself does not exist.

Source

Thrown at modules/editor/traits/FileSystemFunctions.php:183

        }

        if (!strlen($destinationDir)) {
            throw new ApplicationException(Lang::get('editor::lang.filesystem.select_destination_dir'));
        }

        if (!$this->validateFileSystemPath($destinationDir)) {
            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
        }

        // Ensure directory exists
        $destinationFullPath = $basePath.'/'.$destinationDir;
        if (!File::isDirectory($destinationFullPath)) {
            File::makeDirectory($destinationFullPath, 0755, true, true);
        }

        // Path is gone
        if (!file_exists($destinationFullPath) || !is_dir($destinationFullPath)) {
            throw new ApplicationException(Lang::get('editor::lang.filesystem.destination_not_found'));
        }

        foreach ($selectedList as $path) {
            if (!$this->validateFileSystemPath($path)) {
                throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
            }

            $basename = basename($path);
            $originalFullPath = $basePath.'/'.$path;
            $newFullPath = rtrim($destinationFullPath, '/').'/'.$basename;
            $safeDir = $basePath;

            if ($originalFullPath == $newFullPath) {
                continue;
            }

            if ((is_file($originalFullPath) && is_file($newFullPath))
                || (is_dir($originalFullPath) && is_dir($newFullPath))) {

View on GitHub (pinned to b608633a7e)

Solutions

  1. Check whether a FILE exists at the destination path and rename or delete it, then retry
  2. Ensure themes/<theme>/assets is writable by the webserver user so the destination can be auto-created
  3. Create the destination directory in the Editor (new directory command) first, then move
  4. Refresh the sidebar if the parent directory may have been removed externally

Example fix

// before: themes/demo/assets/js/bundle is a FILE
$ mv themes/demo/assets/js/bundle themes/demo/assets/js/bundle.txt
// retry move to 'js/bundle' -> now auto-created as a directory
Defensive patterns

Strategy: validation

Validate before calling

$destinationFullPath = $assetsBase.'/'.$destinationDir;
if (file_exists($destinationFullPath) && !is_dir($destinationFullPath)) {
    // a FILE occupies the path — the auto-mkdir will fail; rename/remove it first
}
if (!is_dir($destinationFullPath) && !is_writable($assetsBase)) {
    // base not writable: the recursive mkdir cannot create the destination
}

Prevention

When it happens

Trigger: command_onAssetMove to 'js/bundle' when themes/<theme>/assets/js/bundle is an existing FILE (name collision); assets directory read-only for the PHP user so the recursive mkdir silently fails; the theme's assets folder was removed on disk while the Editor session stayed open.

Common situations: A file and desired folder share a name (e.g. 'partials' file vs 'partials/' dir); permission drift after deploys; moving into a path whose parent was deleted by git or another session.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/86c39fea0b912ab5. Report an issue: GitHub.