octobercms/october · warning · ApplicationException

editor::lang.filesystem.name_cant_be_empty

Error message

editor::lang.filesystem.name_cant_be_empty

What it means

FileSystemFunctions::editorRenameFileOrDirectory validates the submitted rename value first: it trims the name and throws editor::lang.filesystem.name_cant_be_empty when nothing remains. This is the empty-input guard for the editor's rename operation, fired before any path or extension checks.

Source

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

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

        if (!File::makeDirectory($newFullPath, 0755, true, true)) {
            throw new ApplicationException(Lang::get(
                'editor::lang.filesystem.error_creating_directory',
                ['name' => $newName]
            ));
        }
    }

    /**
     * editorRenameFileOrDirectory
     */
    protected function editorRenameFileOrDirectory($basePath, $name, $originalPath, $allowedFileExtensions)
    {
        $newName = trim($name);
        if (!strlen($newName)) {
            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'));

View on GitHub (pinned to b608633a7e)

Solutions

  1. Supply a non-empty new name in the rename request.
  2. Disable the confirm button until the rename field has non-whitespace content.
  3. Trim and validate client-side before posting.
  4. Verify the parameter key the API expects for the new name.

Example fix

// before
name: '   '

// after
name: 'partials-v2'
Defensive patterns

Strategy: validation

Validate before calling

$newName = trim((string) $name);
if ($newName === '') {
    throw new \ValidationException(['name' => 'New name cannot be empty']);
}

Prevention

When it happens

Trigger: Submitting a rename request with an empty or whitespace-only name; the editor UI sending the form before the rename input is populated; automated callers omitting the name parameter.

Common situations: Rename dialog submitted via Enter with an empty field; JS error clearing the input value; integrations scripting the editor API.

Related errors


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