octobercms/october · error · ValidationException
Desired theme directory already exists.
Error message
Desired theme directory already exists.
What it means
Error "Desired theme directory already exists." thrown in octobercms/october.
Source
Thrown at modules/cms/controllers/Themes.php:208
}
$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', '');
$theme = CmsTheme::load($newDirName);
$theme->writeConfig($data);
Flash::success(__('Theme Created!'));
return Redirect::refresh();
}
/**View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/cms/controllers/Themes.php:208 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/e709195f312b002c.
Report an issue: GitHub.