octobercms/october · error · ApplicationException

editor::lang.filesystem.original_not_found

Error message

editor::lang.filesystem.original_not_found

What it means

Thrown by editorRenameFileOrDirectory when file_exists($basePath.'/'.$originalPath) is false (line 80). The rename target must already exist under the managed base path (for the CMS extension this is themes/<theme>/assets). It means the path passed validation but nothing lives there, usually because the node in the sidebar is stale.

Source

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

            throw new ApplicationException(Lang::get('editor::lang.filesystem.name_cant_be_empty'));
        }

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

        if (!$this->validateFileSystemName($newName)) {
            throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_name'));
        }

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

        $originalFullPath = $basePath.'/'.$originalPath;
        if (!file_exists($originalFullPath)) {
            throw new ApplicationException(Lang::get('editor::lang.filesystem.original_not_found'));
        }

        if (!is_dir($originalFullPath) && !$this->validateFileSystemFileExtension($newName, $allowedFileExtensions)) {
            throw new ApplicationException(Lang::get(
                'editor::lang.filesystem.type_not_allowed',
                ['allowed_types' => implode(', ', $allowedFileExtensions)]
            ));
        }

        // Block renaming to a .svg target
        if (
            !is_dir($originalFullPath) &&
            Config::get('media.clean_vectors', true) &&
            strtolower(File::extension($newName)) === 'svg' &&
            strtolower(File::extension($originalPath)) !== 'svg'
        ) {
            throw new ApplicationException(Lang::get(
                'editor::lang.filesystem.type_not_allowed',

View on GitHub (pinned to b608633a7e)

Solutions

  1. Refresh the Editor sidebar (or reload the page) so the tree reflects the real filesystem, then rename again
  2. Verify the file exists under themes/<theme>/assets/ for the theme sent in the request metadata
  3. Confirm the theme in the request matches the theme whose assets are displayed (validateRequestTheme should already pin this)
  4. If an external process removed the file, restore it (git checkout / redeploy) before renaming

Example fix

// before
$originalPath = 'css/removed-file.css'; // deleted by a deploy

// after
$originalPath = 'css/current-file.css'; // re-selected from a refreshed sidebar
Defensive patterns

Strategy: validation

Validate before calling

$originalFullPath = $assetsBase.'/'.$originalPath; // $assetsBase = themes/<theme>/assets
if (!file_exists($originalFullPath)) {
    // stale sidebar node: refresh tree / re-select before renaming
}

Try / catch

try {
    // rename via editor command or editorRenameFileOrDirectory(...)
} catch (ApplicationException $e) {
    if ($e->getMessage() === Lang::get('editor::lang.filesystem.original_not_found')) {
        // reload the document list, the node is stale
    }
}

Prevention

When it happens

Trigger: command_onAssetRename with an originalPath that no longer exists under themes/<active-theme>/assets: the file was deleted or moved in another tab/session, a deploy or git checkout removed it, the request's 'theme' metadata points at a different theme than the one whose assets are shown, or the casing differs on a case-sensitive filesystem.

Common situations: Two people (or two tabs) editing the same theme's assets; assets replaced by CI/CD while the Editor stays open; switching themes while the sidebar still shows the previous theme's tree; developing on macOS/Windows and deploying to Linux where 'Logo.CSS' != 'logo.css'.

Related errors


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