octobercms/october · error · ValidationException

Please specify a name for the theme.

Error message

Please specify a name for the theme.

What it means

Error "Please specify a name for the theme." thrown in octobercms/october.

Source

Thrown at modules/cms/controllers/Themes.php:200

    /**
     * index_onCreate
     */
    public function index_onCreate()
    {
        if (!BackendAuth::userHasAccess('cms.themes.create')) {
            throw new ForbiddenException;
        }

        $widget = $this->makeCreateFormWidget();
        $data = $widget->getSaveData();
        $newDirName = trim($data['dir_name'] ?? '');
        $destinationPath = themes_path().'/'.$newDirName;

        $data = array_except($data, 'dir_name');

        if (!strlen(trim($data['name'] ?? ''))) {
            throw new ValidationException(['name' => __('Please specify a name for the theme.')]);
        }

        if (!preg_match('/^[a-z0-9\_\-]+$/i', $newDirName)) {
            throw new ValidationException(['dir_name' => __('Name can contain only digits, Latin letters and the following symbols: _-')]);
        }

        if (File::isDirectory($destinationPath)) {
            throw new ValidationException(['dir_name' => __('Desired theme directory already exists.')]);
        }

        File::makeDirectory($destinationPath);
        File::makeDirectory($destinationPath.'/assets');
        File::makeDirectory($destinationPath.'/content');
        File::makeDirectory($destinationPath.'/layouts');
        File::makeDirectory($destinationPath.'/pages');
        File::makeDirectory($destinationPath.'/partials');
        File::put($destinationPath.'/theme.yaml', '');

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/cms/controllers/Themes.php:200 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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