{"record":{"id":"e43ac52d28abf74a","repo":"nextcloud/server","slug":"could-not-enable-app","errorCode":null,"errorMessage":"could not enable app","messagePattern":"could not enable app","errorType":"http","errorClass":"OCSException","httpStatus":500,"severity":"error","filePath":"apps/appstore/lib/Controller/ApiController.php","lineNumber":188,"sourceCode":"\n\t\t\t// Check if app is already downloaded\n\t\t\tif (!$this->installer->isDownloaded($appId)) {\n\t\t\t\t$this->installer->downloadApp($appId);\n\t\t\t}\n\n\t\t\t$this->installer->installApp($appId);\n\n\t\t\tif ($groups !== []) {\n\t\t\t\t$this->appManager->enableAppForGroups($appId, $this->getGroupList($groups));\n\t\t\t} else {\n\t\t\t\t$this->appManager->enableApp($appId);\n\t\t\t}\n\n\t\t\t$updateRequired = $this->appManager->isUpgradeRequired($appId);\n\t\t\treturn new DataResponse(['update_required' => $updateRequired]);\n\t\t} catch (\\Throwable $throwable) {\n\t\t\t$this->logger->error('could not enable app', ['exception' => $throwable]);\n\t\t\tthrow new OCSException('could not enable app', Http::STATUS_INTERNAL_SERVER_ERROR, $throwable);\n\t\t}\n\t}\n\n\t/**\n\t * Disable an app\n\t *\n\t * @param string $appId - The app to disable\n\t *\n\t * @return DataResponse<Http::STATUS_OK, array{}, array{}>\n\t * @throws OCSException - if the app could not be disabled\n\t *\n\t * 200: App successfully disabled\n\t */\n\t#[PasswordConfirmationRequired(strict: false)]\n\t#[ApiRoute(verb: 'POST', url: '/api/v1/apps/disable')]\n\tpublic function disableApp(string $appId): DataResponse {\n\t\ttry {\n\t\t\t$appId = $this->appManager->cleanAppId($appId);","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/appstore/lib/Controller/ApiController.php#L170-L206","documentation":"OCSException (HTTP 500) thrown by ApiController::enableApp when anything inside the try block throws: installer->installApp($appId), appManager->enableApp / enableAppForGroups, or the upgrade-required check. The original Throwable is logged ('could not enable app' with exception context) and chained into the OCS response, so the real cause is in nextcloud.log.","triggerScenarios":"POST /ocs/appstore/apps/enable failing because the app download from the app store failed (no egress to apps.nextcloud.com), archive extraction failed (apps/ not writable), appinfo.xml invalid, PHP version or dependencies missing, the app already partially installed, or database errors while enabling.","commonSituations":"Self-hosted instance without internet access; apps directory owned by root; app requiring a newer PHP/NC version than the server; appstore rate-limiting or CDN outage; concurrent enable requests racing.","solutions":["Read the chained exception in nextcloud.log — the message there names the actual failure (download, extraction, missing dependency)","Verify the apps/ folder is writable by the web server user and the server can reach the app store URL","Try `occ app:install <appId>` from the CLI to get the full stack trace and confirm it reproduces","Check the app's requirements (PHP version, NC version) against the server before enabling"],"exampleFix":"// client: surface the OCS message and guide to logs\ntry {\n\tawait axios.post(generateOcsUrl('/apps/appstore/apps/enable'), { appId })\n} catch (e) {\n\tshowError(t('appstore', 'Enabling {appId} failed — check the server log', { appId }))\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// OCS client\ntry {\n\tawait axios.post(generateOcsUrl('/apps/appstore/apps/enable'), { appId, groups: [] })\n} catch (e) {\n\t// HTTP 500 with 'could not enable app' — the chained exception is in nextcloud.log\n\tshowError(t('settings', 'Enabling the app failed. Check the Nextcloud log for details.'))\n}","preventionTips":["Check apps/ writability and appstore egress before bulk-enabling apps","Match app requirements (PHP/NC version) to the server before enabling","Prefer `occ app:install` when diagnosing — CLI output includes the full trace"],"tags":["appstore","apps","admin","php","ocs"],"backgroundTag":"app-install-failed","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}