{"record":{"id":"76cb09d0dd1ce12c","repo":"octobercms/october","slug":"theme-name-not-found","errorCode":null,"errorMessage":"Theme [$name] not found","messagePattern":"Theme \\[\\$name\\] not found","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/system/classes/updatemanager/ManagesThemes.php","lineNumber":71,"sourceCode":"            $composerVersion = $details['composer_version'] ?? '';\n        }\n\n        return [$composerCode, $composerVersion];\n    }\n\n    /**\n     * uninstallTheme attempts to remove the theme using composer before\n     * deleting from the filesystem\n     */\n    public function uninstallTheme($name)\n    {\n        $themeExists = CmsTheme::exists($name);\n        if (!$themeExists) {\n            $name = (string) $this->themeManager->findDirectoryName($name);\n        }\n\n        if (!CmsTheme::exists($name)) {\n            throw new ApplicationException(\"Theme [$name] not found\");\n        }\n\n        // Remove via composer\n        $composer = ComposerManager::instance();\n        $composerCode = $this->themeManager->getComposerCode($name);\n\n        if ($composerCode && $composer->hasPackage($composerCode)) {\n            $composer->remove([$composerCode]);\n        }\n\n        $this->themeManager->deleteTheme($name);\n    }\n\n    /**\n     * requestThemeDetails looks up a theme from the update server\n     */\n    public function requestThemeDetails(string $name): array\n    {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/classes/updatemanager/ManagesThemes.php#L53-L89","documentation":"UpdateManager::uninstallTheme() removes a theme via composer and then deletes its directory. It accepts either an October code or a directory name: if CmsTheme::exists($name) fails it retries after themeManager->findDirectoryName($name). If the theme still does not exist, it throws 'Theme [$name] not found' — nothing is installed under that identifier.","triggerScenarios":"uninstallTheme('author.theme') when themes/author-theme/ does not exist; calling uninstall twice in a row; passing a display name instead of the code/directory name; the directory was already deleted by hand or by git.","commonSituations":"Theme folder removed manually while the backend still lists it (stale theme list/record); double-uninstall from the Updates UI; case mismatch between the stored name and the actual directory on a case-sensitive filesystem.","solutions":["List the actual directories under /themes and pass the exact one (lowercase, dots converted to dashes, e.g. author-theme)","Guard with Cms\\Classes\\Theme::exists($name) before calling uninstallTheme","If the directory is gone but the theme still appears in the backend, refresh/clear the cached theme list so the stale entry disappears","For composer-installed themes whose folder is already gone, check composer.json and run composer remove for the package, then delete any leftover directory"],"exampleFix":"// before\nUpdateManager::instance()->uninstallTheme($name);\n\n// after\nif (!\\Cms\\Classes\\Theme::exists($name)) {\n    $name = strtolower(str_replace('.', '-', $name));\n}\nif (\\Cms\\Classes\\Theme::exists($name)) {\n    UpdateManager::instance()->uninstallTheme($name);\n}","handlingStrategy":"validation","validationCode":"if (!\\Cms\\Classes\\Theme::exists($name)) {\n    $name = strtolower(str_replace('.', '-', $name));\n}\nif (\\Cms\\Classes\\Theme::exists($name)) {\n    \\UpdateManager::instance()->uninstallTheme($name);\n}","typeGuard":null,"tryCatchPattern":"try { \\UpdateManager::instance()->uninstallTheme($name); } catch (\\ApplicationException $ex) { /* treat as already-removed or surface the message */ }","preventionTips":["Build uninstall UI from the live theme list (Theme::all()) so only existing themes are offered","Pass the directory name (lowercase, dashes) rather than display names","Avoid deleting theme directories by hand; let the manager keep state consistent"],"tags":["theme","uninstall","filesystem"],"backgroundTag":"resource-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}