octobercms/october · error · ValidationException
Name can contain only digits, Latin letters and the followin
Error message
Name can contain only digits, Latin letters and the following symbols: _-
What it means
Error "Name can contain only digits, Latin letters and the following symbols: _-" thrown in octobercms/october.
Source
Thrown at modules/cms/controllers/Themes.php:204
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', '');
$theme = CmsTheme::load($newDirName);
$theme->writeConfig($data);
Flash::success(__('Theme Created!'));View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/cms/controllers/Themes.php:204 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/44c7df4f1ada940b.
Report an issue: GitHub.