{"record":{"id":"e709195f312b002c","repo":"octobercms/october","slug":"desired-theme-directory-already-exists","errorCode":null,"errorMessage":"Desired theme directory already exists.","messagePattern":"Desired theme directory already exists\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"modules/cms/controllers/Themes.php","lineNumber":208,"sourceCode":"        }\n\n        $widget = $this->makeCreateFormWidget();\n        $data = $widget->getSaveData();\n        $newDirName = trim($data['dir_name'] ?? '');\n        $destinationPath = themes_path().'/'.$newDirName;\n\n        $data = array_except($data, 'dir_name');\n\n        if (!strlen(trim($data['name'] ?? ''))) {\n            throw new ValidationException(['name' => __('Please specify a name for the theme.')]);\n        }\n\n        if (!preg_match('/^[a-z0-9\\_\\-]+$/i', $newDirName)) {\n            throw new ValidationException(['dir_name' => __('Name can contain only digits, Latin letters and the following symbols: _-')]);\n        }\n\n        if (File::isDirectory($destinationPath)) {\n            throw new ValidationException(['dir_name' => __('Desired theme directory already exists.')]);\n        }\n\n        File::makeDirectory($destinationPath);\n        File::makeDirectory($destinationPath.'/assets');\n        File::makeDirectory($destinationPath.'/content');\n        File::makeDirectory($destinationPath.'/layouts');\n        File::makeDirectory($destinationPath.'/pages');\n        File::makeDirectory($destinationPath.'/partials');\n        File::put($destinationPath.'/theme.yaml', '');\n\n        $theme = CmsTheme::load($newDirName);\n        $theme->writeConfig($data);\n\n        Flash::success(__('Theme Created!'));\n        return Redirect::refresh();\n    }\n\n    /**","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/controllers/Themes.php#L190-L226","documentation":"Error \"Desired theme directory already exists.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/cms/controllers/Themes.php:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}